From 4d57da10826ca7b3baf49943dc8fcb837ad9032e Mon Sep 17 00:00:00 2001 From: Brendan Gregg Date: Tue, 19 Jan 2016 00:55:12 -0800 Subject: [PATCH] stack walker typo and improvement --- tools/offcputime | 2 +- tools/stackcount | 6 +++--- tools/stacksnoop | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/offcputime b/tools/offcputime index 4ab94394a1ae..f61fc42cc2d9 100755 --- a/tools/offcputime +++ b/tools/offcputime @@ -74,7 +74,7 @@ static u64 get_frame(u64 *bp) { if (bpf_probe_read(&ret, sizeof(ret), (void *)(*bp+8))) return 0; if (bpf_probe_read(bp, sizeof(*bp), (void *)*bp)) - bp = 0; + *bp = 0; if (ret < __START_KERNEL_map) return 0; return ret; diff --git a/tools/stackcount b/tools/stackcount index b6cc3b68ffa4..7b4aa43eff06 100755 --- a/tools/stackcount +++ b/tools/stackcount @@ -86,10 +86,10 @@ static u64 get_frame(u64 *bp) { u64 ret = 0; if (bpf_probe_read(&ret, sizeof(ret), (void *)(*bp+8))) return 0; - if (!ret || ret < __START_KERNEL_map) - return 0; if (bpf_probe_read(bp, sizeof(*bp), (void *)*bp)) - bp = 0; + *bp = 0; + if (ret < __START_KERNEL_map) + return 0; return ret; } return 0; diff --git a/tools/stacksnoop b/tools/stacksnoop index bd5c0c9ca146..d8ced4e62cbf 100755 --- a/tools/stacksnoop +++ b/tools/stacksnoop @@ -56,7 +56,7 @@ static int print_frame(u64 *bp, int *depth) { u64 ret = 0; if (bpf_probe_read(&ret, sizeof(ret), (void *)(*bp+8))) return 0; - if (!ret || ret < __START_KERNEL_map) + if (ret < __START_KERNEL_map) return 0; bpf_trace_printk("r%d: %llx\\n", *depth, ret); if (bpf_probe_read(bp, sizeof(*bp), (void *)*bp))