Skip to content

Commit 008590e

Browse files
committed
Always fall back to symtab/dynsym to fill in info we didn't get from DWARF
This restores symbols in the crash report for any frames our DWARF reader didn't fill in (GCC LTO, dwz, alt-file refs, etc). [Bug #22188]
1 parent c6e3e8c commit 008590e

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

addr2line.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2219,8 +2219,9 @@ fill_lines(int num_traces, void **traces, int check_debuglink,
22192219
goto use_symtab;
22202220
}
22212221
}
2222-
else {
2223-
/* This file doesn't have dwarf, use symtab or dynsym */
2222+
/* Always fall back to .symtab/.dynsym for any trace frame that didn't set
2223+
* sname via DWARF so frames still get name+offset instead of bare address. */
2224+
{
22242225
use_symtab:
22252226
if (!symtab_shdr) {
22262227
/* This file doesn't have symtab, use dynsym instead */
@@ -2238,7 +2239,8 @@ fill_lines(int num_traces, void **traces, int check_debuglink,
22382239
if (ELF_ST_TYPE(sym->st_info) != STT_FUNC) continue;
22392240
for (i = offset; i < num_traces; i++) {
22402241
uintptr_t d = (uintptr_t)traces[i] - saddr;
2241-
if (lines[i].line > 0 || d > (uintptr_t)sym->st_size)
2242+
/* Only proceed if we didn't already get name or line info. */
2243+
if (lines[i].sname || lines[i].line > 0 || d > (uintptr_t)sym->st_size)
22422244
continue;
22432245
/* fill symbol name and addr from .symtab */
22442246
if (!lines[i].sname) lines[i].sname = strtab + sym->st_name;

0 commit comments

Comments
 (0)