From 8afaddfa01fbad82558844a5860679ee9bb9d93a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20M=C3=BCller?= Date: Wed, 17 Jul 2024 10:57:45 -0700 Subject: [PATCH] c/profile: Short circuit on errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Report proper errors when symbolization fails and bail out early. Signed-off-by: Daniel Müller --- examples/c/profile.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/c/profile.c b/examples/c/profile.c index b1912458..4be01a66 100644 --- a/examples/c/profile.c +++ b/examples/c/profile.c @@ -80,6 +80,10 @@ static void show_stack_trace(__u64 *stack, int stack_sz, pid_t pid) result = blaze_symbolize_kernel_abs_addrs(symbolizer, &src, (const uintptr_t *)stack, stack_sz); } + if (result == NULL) { + printf(" failed to symbolize addresses: %s\n", blaze_err_str(blaze_err_last())); + return; + } for (i = 0; i < stack_sz; i++) { if (!result || result->cnt <= i || result->syms[i].name == NULL) {