From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12402 invoked by alias); 9 Jun 2015 21:56:53 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 12388 invoked by uid 89); 9 Jun 2015 21:56:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-oi0-f42.google.com Received: from mail-oi0-f42.google.com (HELO mail-oi0-f42.google.com) (209.85.218.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 09 Jun 2015 21:56:51 +0000 Received: by oihd6 with SMTP id d6so20275900oih.2 for ; Tue, 09 Jun 2015 14:56:49 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.182.42.232 with SMTP id r8mr21674198obl.26.1433887009691; Tue, 09 Jun 2015 14:56:49 -0700 (PDT) Received: by 10.76.83.68 with HTTP; Tue, 9 Jun 2015 14:56:49 -0700 (PDT) Date: Tue, 09 Jun 2015 21:56:00 -0000 Message-ID: Subject: Adding a new sysroot method for finding debug files From: =?UTF-8?Q?C=C3=A9dric_Buissart?= To: gdb@sourceware.org Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2015-06/txt/msg00001.txt.bz2 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 /, instead of just /. 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; + } } }