Skip to content

Commit 00c99c0

Browse files
d-e-s-oanakryiko
authored andcommitted
c/profile: Short circuit on errors
Report proper errors when symbolization fails and bail out early. Signed-off-by: Daniel Müller <[email protected]>
1 parent ceb0dc3 commit 00c99c0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

examples/c/profile.c

+4
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ static void show_stack_trace(__u64 *stack, int stack_sz, pid_t pid)
8080
result = blaze_symbolize_kernel_abs_addrs(symbolizer, &src, (const uintptr_t *)stack, stack_sz);
8181
}
8282

83+
if (result == NULL) {
84+
printf(" failed to symbolize addresses: %s\n", blaze_err_str(blaze_err_last()));
85+
return;
86+
}
8387

8488
for (i = 0; i < stack_sz; i++) {
8589
if (!result || result->cnt <= i || result->syms[i].name == NULL) {

0 commit comments

Comments
 (0)