From 068076d4dfe29ca71626beaa8840c47c18eeb332 Mon Sep 17 00:00:00 2001 From: Pierrick Bouvier Date: Fri, 24 Apr 2026 12:44:50 -0700 Subject: [PATCH] contrib/plugins/uftrace_symbols.py: handle missing source line from addr2line Some symbols have only a file information, and no line information. In this case, addr2line reports '?'. Replace with 0 to guarantee consistent data for consumers. Reviewed-by: Manos Pitsidianakis Link: https://lore.kernel.org/qemu-devel/20260424194451.1439316-3-pierrick.bouvier@oss.qualcomm.com Signed-off-by: Pierrick Bouvier --- contrib/plugins/uftrace_symbols.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/plugins/uftrace_symbols.py b/contrib/plugins/uftrace_symbols.py index 6eb999bca5..9f0095e73b 100755 --- a/contrib/plugins/uftrace_symbols.py +++ b/contrib/plugins/uftrace_symbols.py @@ -70,7 +70,10 @@ def find_symbols_locations(elf_file, symbols): file, line = out[i].split(':') # addr2line may return 'line (discriminator [0-9]+)' sometimes, # remove this to keep only line number. - line = line.split(' ')[0] + if line == '?': + line = 0 + else: + line = int(line.split(' ')[0]) s.set_loc(file, line) class BinaryFile: