[PATCH 0/2] Some fixes for debug files and sysroots

John Baldwin
2019-01-23T01:04:16Z

When working on non-x86 architectures, I often install a base system
to a sysroot directory that I then use to generate a filesystem for
use with qemu using a tool like makefs. Since this sysroot is a full
system install, it also contains a nested global debugfile directory
for base system libraries and binaries (e.g.
/sysroot/usr/lib/debug/bin/ls.debug for /sysroot/bin/ls). GDB's
current logic for handling separate debug files does not look for
debug files in debug directories under a sysroot. These two patches
seek to make this work seamlessly (my current workaround is to go
create a symlink from /usr/lib/debug/sysroot to /sysroot/usr/lib/debug
on the host and these patches remove the need for that).

The first patch augments the existing logic to add another path check
for <sysroot>/<debug_dir>/<debugfile>. The second patch is a
convenience to deal with tab completion of directories passed to 'set
sysroot' usually adding a trailing / that then breaks the logic for
separate debug files. Rather than trying to cope with a possible
trailing separator in find_separate_debug_file, I instead chose to
"fix" the sysroot to when it is set to remove the trailing /. One
downside of this is that it doesn't fix a static sysroot set at build
time with --sysroot.

John Baldwin (2):
Look for separate debug files in debug directories under a sysroot.
Trim trailing directory separators from new sysroots.

gdb/ChangeLog | 10 ++++++++++
gdb/solib.c | 8 ++++++++
gdb/symfile.c | 19 +++++++++++++++++++
3 files changed, 37 insertions(+)

--
2.19.2