Commit 4d57da10 authored by Brendan Gregg's avatar Brendan Gregg

stack walker typo and improvement

parent 38cef486
...@@ -74,7 +74,7 @@ static u64 get_frame(u64 *bp) { ...@@ -74,7 +74,7 @@ static u64 get_frame(u64 *bp) {
if (bpf_probe_read(&ret, sizeof(ret), (void *)(*bp+8))) if (bpf_probe_read(&ret, sizeof(ret), (void *)(*bp+8)))
return 0; return 0;
if (bpf_probe_read(bp, sizeof(*bp), (void *)*bp)) if (bpf_probe_read(bp, sizeof(*bp), (void *)*bp))
bp = 0; *bp = 0;
if (ret < __START_KERNEL_map) if (ret < __START_KERNEL_map)
return 0; return 0;
return ret; return ret;
......
...@@ -86,10 +86,10 @@ static u64 get_frame(u64 *bp) { ...@@ -86,10 +86,10 @@ static u64 get_frame(u64 *bp) {
u64 ret = 0; u64 ret = 0;
if (bpf_probe_read(&ret, sizeof(ret), (void *)(*bp+8))) if (bpf_probe_read(&ret, sizeof(ret), (void *)(*bp+8)))
return 0; return 0;
if (!ret || ret < __START_KERNEL_map)
return 0;
if (bpf_probe_read(bp, sizeof(*bp), (void *)*bp)) if (bpf_probe_read(bp, sizeof(*bp), (void *)*bp))
bp = 0; *bp = 0;
if (ret < __START_KERNEL_map)
return 0;
return ret; return ret;
} }
return 0; return 0;
......
...@@ -56,7 +56,7 @@ static int print_frame(u64 *bp, int *depth) { ...@@ -56,7 +56,7 @@ static int print_frame(u64 *bp, int *depth) {
u64 ret = 0; u64 ret = 0;
if (bpf_probe_read(&ret, sizeof(ret), (void *)(*bp+8))) if (bpf_probe_read(&ret, sizeof(ret), (void *)(*bp+8)))
return 0; return 0;
if (!ret || ret < __START_KERNEL_map) if (ret < __START_KERNEL_map)
return 0; return 0;
bpf_trace_printk("r%d: %llx\\n", *depth, ret); bpf_trace_printk("r%d: %llx\\n", *depth, ret);
if (bpf_probe_read(bp, sizeof(*bp), (void *)*bp)) if (bpf_probe_read(bp, sizeof(*bp), (void *)*bp))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment