diff options
| -rw-r--r-- | libdwfl/ChangeLog | 9 | ||||
| -rw-r--r-- | libdwfl/find-debuginfo.c | 13 | ||||
| -rw-r--r-- | libdwfl/libdwfl.h | 14 |
3 files changed, 29 insertions, 7 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 5059be6d..3e36aa75 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,12 @@ +2015-08-14 Dodji Seketeli <[email protected]> + + * find-debuginfo.c (find_debuginfo_in_path): Try to locate the + debug info file named debuglink_file under + mod->dwfl->callbacks->debuginfo_path, by looking at + the set of sub-trees under mod->dwfl->callbacks->debuginfo_path + which is common to the set of non-absolute parent trees of + file_name. + 2015-06-18 Mark Wielaard <[email protected]> * find-debuginfo.c (try_open): Free fname on all failure paths. diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c index 1faa494d..6b8d1ac4 100644 --- a/libdwfl/find-debuginfo.c +++ b/libdwfl/find-debuginfo.c @@ -252,7 +252,15 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name, dir = p; if (mod->dw == NULL) { - subdir = file_dirname + 1; + subdir = file_dirname; + /* We want to explore all sub-subdirs. Chop off one slash + at a time. */ + explore_dir: + subdir = strchr (subdir, '/'); + if (subdir != NULL) + subdir = subdir + 1; + if (subdir && *subdir == 0) + continue; file = debuglink_file; } else @@ -292,6 +300,9 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name, } break; } + /* If possible try again with a sub-subdir. */ + if (mod->dw == NULL && subdir) + goto explore_dir; continue; default: goto fail_free; diff --git a/libdwfl/libdwfl.h b/libdwfl/libdwfl.h index 2bb4f455..1098c833 100644 --- a/libdwfl/libdwfl.h +++ b/libdwfl/libdwfl.h @@ -275,12 +275,14 @@ extern int dwfl_module_build_id (Dwfl_Module *mod, In searches for debuginfo by name, if the remainder of the element is empty, the directory containing the main file is tried; if it's an absolute path name, the absolute directory path - containing the main file is taken as a subdirectory of this path; - a relative path name is taken as a subdirectory of the directory - containing the main file. Hence for /bin/ls, the default string - ":.debug:/usr/lib/debug" says to look in /bin, then /bin/.debug, - then /usr/lib/debug/bin, for the file name in the .gnu_debuglink - section (or "ls.debug" if none was found). */ + (and any subdirectory of that path) containing the main file is + taken as a subdirectory of this path; a relative path name is taken + as a subdirectory of the directory containing the main file. + Hence for /usr/bin/ls, the default string ":.debug:/usr/lib/debug" + says to look in /usr/bin, then /usr/bin/.debug, then the path subdirs + under /usr/lib/debug, in the order /usr/lib/debug/usr/bin, then + /usr/lib/debug/bin, and finally /usr/lib/debug, for the file name in + the .gnu_debuglink section (or "ls.debug" if none was found). */ /* Standard find_elf callback function working solely on build ID. This can be tried first by any find_elf callback, to use the |
