mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2025-02-04 13:32:55 +01:00
linux: Add /usr/lib/debug symbol path checking
Debian likes to hive off symbol information to separate -dbg packages, installing the debug information in a parallel tree rooted at /usr/lib/debug. libunwind doesn't know how to find these files but it's easy, per the tested, attached patch, to make it so. I don't see /usr/lib/debug at http://www.pathname.com/fhs/pub/fhs-2.3.html#USRLIBLIBRARIESFORPROGRAMMINGANDPA but https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Debugging_with_gdb/separate-debug-files.html says it's not just Debian and hints it might be driven by gdb. I do see mention of /usr/lib/debug in libunwind already, but only in a DWARF-specific part of the code. A minor concern might be checking errno to see if the problem is ENOENT before trying the alternate path. That might be better than flogging a mmap problem or being out of file handles or whatever.
This commit is contained in:
parent
a51cf49031
commit
1f4929c05d
1 changed files with 7 additions and 1 deletions
|
@ -37,6 +37,7 @@ tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
|
||||||
struct map_iterator mi;
|
struct map_iterator mi;
|
||||||
int found = 0, rc;
|
int found = 0, rc;
|
||||||
unsigned long hi;
|
unsigned long hi;
|
||||||
|
char debug_path[PATH_MAX];
|
||||||
|
|
||||||
if (maps_init (&mi, pid) < 0)
|
if (maps_init (&mi, pid) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -57,7 +58,12 @@ tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip,
|
||||||
{
|
{
|
||||||
strncpy(path, mi.path, pathlen);
|
strncpy(path, mi.path, pathlen);
|
||||||
}
|
}
|
||||||
rc = elf_map_image (ei, mi.path);
|
snprintf (debug_path, sizeof (debug_path), "/usr/lib/debug%s", mi.path);
|
||||||
|
rc = elf_map_image (ei, debug_path);
|
||||||
|
if (rc != 0)
|
||||||
|
{
|
||||||
|
rc = elf_map_image (ei, mi.path);
|
||||||
|
}
|
||||||
maps_close (&mi);
|
maps_close (&mi);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue