File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ import ..API
8282include (" host/syscall.jl" )
8383include (" host/maps.jl" )
8484include (" host/socket.jl" )
85+ include (" host/kallsyms.jl" )
8586end
8687
8788# Compiler
Original file line number Diff line number Diff line change 1+ function find_ksym (addr:: UInt64 )
2+ start, stop = UInt64 (0 ), addr
3+ rgx = r" ([0-9abcdef]*) ([a-zA-Z]) ([0-9a-zA-Z_\- ]*)"
4+ last_addr = start
5+ last_kind = " ?"
6+ last_name = " "
7+ for line in readlines (open (" /proc/kallsyms" , " r" ))
8+ m = match (rgx, line)
9+ @assert m != = nothing
10+ start_addr, kind, name = m. captures
11+ start_addr = parse (UInt64, " 0x" * start_addr)
12+ if start_addr > stop
13+ return last_addr, last_kind, last_name
14+ elseif start_addr == stop
15+ return addr, kind, name
16+ end
17+ last_addr = addr
18+ last_kind = kind
19+ last_name = name
20+ end
21+ end
22+ function stack_to_string (nt:: NTuple{N,UInt64} ) where N
23+ iob = IOBuffer ()
24+ for i in 1 : N
25+ addr = nt[i]
26+ if addr == UInt64 (0 )
27+ break
28+ end
29+ println (iob, " $(find_ksym (addr)[3 ]) " )
30+ end
31+ String (take! (iob))
32+ end
You can’t perform that action at this time.
0 commit comments