-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from jpsamaroo/jps/stacks-on-stacks
Add stack helpers and more
- Loading branch information
Showing
10 changed files
with
321 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "BPFnative" | ||
uuid = "b6338580-32ea-11e9-1791-33a79977d8c4" | ||
authors = ["Julian P Samaroo <[email protected]>"] | ||
version = "0.1.4" | ||
version = "0.1.5" | ||
|
||
[deps] | ||
CBinding = "d43a6710-96b8-4a2d-833c-c424785e5374" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -255,6 +255,8 @@ end | |
sk_assign | ||
end | ||
|
||
const PERF_MAX_STACK_DEPTH = 127 | ||
|
||
# Kernel structures | ||
|
||
if has_vmlinux | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
function find_ksym(addr::UInt64) | ||
start, stop = UInt64(0), addr | ||
rgx = r"([0-9abcdef]*) ([a-zA-Z]) ([0-9a-zA-Z_\-]*)" | ||
last_addr = start | ||
last_kind = "?" | ||
last_name = "" | ||
for line in readlines(open("/proc/kallsyms", "r")) | ||
m = match(rgx, line) | ||
@assert m !== nothing | ||
start_addr, kind, name = m.captures | ||
start_addr = parse(UInt64, "0x"*start_addr) | ||
if start_addr > stop | ||
return last_addr, last_kind, last_name | ||
elseif start_addr == stop | ||
return addr, kind, name | ||
end | ||
last_addr = addr | ||
last_kind = kind | ||
last_name = name | ||
end | ||
end | ||
function stack_to_string(nt::NTuple{N,UInt64}) where N | ||
iob = IOBuffer() | ||
for i in 1:N | ||
addr = nt[i] | ||
if addr == UInt64(0) | ||
break | ||
end | ||
println(iob, "$(find_ksym(addr)[3])") | ||
end | ||
String(take!(iob)) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
742463b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register()
742463b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/38081
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: