@@ -27,6 +27,11 @@ static void print_ksym(__u64 addr)
if (!addr)
return;
sym = ksym_search(addr);
+ if (!sym) {
+ printf("%llx;", addr);
+ return;
+ }
+
if (PRINT_RAW_ADDR)
printf("%s/%llx;", sym->name, addr);
else
@@ -36,7 +36,10 @@ int main(int ac, char **argv)
bpf_map_lookup_elem(map_fd[0], &next_key, &value);
assert(next_key == value);
sym = ksym_search(value);
- printf(" %s", sym->name);
+ if (!sym)
+ printf(" %lx", value);
+ else
+ printf(" %s", sym->name);
key = next_key;
}
if (key)
@@ -33,6 +33,11 @@ static void print_ksym(__u64 addr)
if (!addr)
return;
sym = ksym_search(addr);
+ if (!sym) {
+ printf("%llx;", addr);
+ return;
+ }
+
printf("%s;", sym->name);
if (!strcmp(sym->name, "sys_read"))
sys_read_seen = true;
This commit handles NULL pointer returned by ksym_search() to directly print address hexadecimal value, the change is applied in 'trace_event', 'spintest' and 'offwaketime' programs. Signed-off-by: Leo Yan <leo.yan@linaro.org> --- samples/bpf/offwaketime_user.c | 5 +++++ samples/bpf/spintest_user.c | 5 ++++- samples/bpf/trace_event_user.c | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-) -- 1.9.1