public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Adding a new sysroot method for finding debug files
@ 2015-06-09 21:56 Cédric Buissart
  2015-06-09 22:30 ` Sergio Durigan Junior
  0 siblings, 1 reply; 2+ messages in thread
From: Cédric Buissart @ 2015-06-09 21:56 UTC (permalink / raw)
  To: gdb

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;
+            }
        }
     }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Adding a new sysroot method for finding debug files
  2015-06-09 21:56 Adding a new sysroot method for finding debug files Cédric Buissart
@ 2015-06-09 22:30 ` Sergio Durigan Junior
  0 siblings, 0 replies; 2+ messages in thread
From: Sergio Durigan Junior @ 2015-06-09 22:30 UTC (permalink / raw)
  To: Cédric Buissart; +Cc: gdb

On Tuesday, June 09 2015, Cédric Buissart wrote:

> 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.

Hi Cédric,

The right list to send patches is gdb-patches@sourceware.org.  Also,
your MUA mangled the patch (Gmail is known to do that), so I recommend
you to send the patch as an attachment instead of inline.  That may
help.

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-09 22:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-09 21:56 Adding a new sysroot method for finding debug files Cédric Buissart
2015-06-09 22:30 ` Sergio Durigan Junior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).