This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Adding a new sysroot method for finding debug files
- From: CÃdric Buissart <cedric dot buissart at gmail dot com>
- To: gdb at sourceware dot org
- Date: Tue, 9 Jun 2015 23:56:49 +0200
- Subject: Adding a new sysroot method for finding debug files
- Authentication-results: sourceware.org; auth=none
Hi all,
I've never sent or discuss the patch before, thus I am unsure I reach
the correct mailing list, but I ll still try.
I've been using internally the patch below for my own setup for about
a year, and I was wondering if it could help other people too and also
put my own setup in production.
Basically, that patch makes it easier to use sysroot ... as a normal
sysroot : debug files would additionally be searched in
<sysroot>/<debugdir>, instead of just <debugdir>/<sysroot>.
It allows to create a sample of the targeted OS anywhere (i.e. :
extracting necessary packages & debuginfo), and pointing gdb_sysroot
to it : gdb will search all the required files from within
gdb_sysroot.
Benefits :
- no need for recreating a full OS or a container to open a coredump.
- you can use a modern GDB, with your own plugins and scripts, to
diagnose a coredump created on an old OS
- you can export the recreated OS sample and let other people mount
and use their own gdb to look at the coredump.
There might be a bit of additional changes required, such as similar
changes for searching the source, so that gdb can find them within the
sysroot as well. But that patch made my life a lot simpler.
I am unsure this was sufficiently clearly explained, but I hope I will
trigger your interest.
:) If you have a better way of easy opening coredump without building
a whole OS/container and without that patch, please let me know
Cedric
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 84858dc..0f68885 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1533,6 +1533,18 @@ find_separate_debug_file (const char *dir,
do_cleanups (back_to);
return debugfile;
}
+
+ /* or we can try to inject debugdir between sysroot and
normal path */
+ strcpy (debugfile, gdb_sysroot);
+ strcat (debugfile, debugdir);
+ strcat (debugfile, canon_dir + strlen (gdb_sysroot));
+ strcat (debugfile, "/");
+ strcat (debugfile, debuglink);
+ if (separate_debug_file_exists (debugfile, crc32, objfile))
+ {
+ do_cleanups (back_to);
+ return debugfile;
+ }
}
}