From patchwork Tue Jun 16 09:42:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary Benson X-Patchwork-Id: 7202 Received: (qmail 114011 invoked by alias); 16 Jun 2015 09:50:39 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 114000 invoked by uid 89); 16 Jun 2015 09:50:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 16 Jun 2015 09:50:38 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id A9C9FB8BC6; Tue, 16 Jun 2015 09:42:53 +0000 (UTC) Received: from blade.nx (ovpn-116-89.ams2.redhat.com [10.36.116.89]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t5G9grQW013508; Tue, 16 Jun 2015 05:42:53 -0400 Received: from blade.nx (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id E1918263030; Tue, 16 Jun 2015 10:42:51 +0100 (BST) From: Gary Benson To: gdb-patches@sourceware.org Cc: =?UTF-8?q?C=C3=A9dric=20Buissart?= Subject: [PATCH 5/5] Also look for debug files in gdb_sysroot Date: Tue, 16 Jun 2015 10:42:48 +0100 Message-Id: <1434447768-17328-6-git-send-email-gbenson@redhat.com> In-Reply-To: <1434447768-17328-1-git-send-email-gbenson@redhat.com> References: <1434447768-17328-1-git-send-email-gbenson@redhat.com> X-IsSubscribed: yes This commit makes GDB look for separate debug files in gdb_sysroot if not found in the currently searched locations. This allows for easier analysis of core files from foreign machines using the sysroot option. The user creates or mounts a directory containing the necessary binaries and debuginfo and then sets GDB's sysroot to that directory before starting their debug session. gdb/ChangeLog: * gdb/symfile.c (find_separate_debug_file): In debugdir loop, also try alternate directory prefixed with gdb_sysroot. --- gdb/ChangeLog | 6 ++++++ gdb/symfile.c | 11 +++++++++++ 2 files changed, 17 insertions(+), 0 deletions(-) diff --git a/gdb/symfile.c b/gdb/symfile.c index 0cc940a..1cd99ea 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1613,6 +1613,7 @@ find_separate_debug_file (const char *dir, if (altdir != NULL) { + /* Try in the alternate directory directly. */ debugfile = build_debug_file_name (no_prefix, debugdir, altdir, debuglink, NULL); if (separate_debug_file_exists (debugfile, crc32, objfile)) @@ -1621,6 +1622,16 @@ find_separate_debug_file (const char *dir, return debugfile; } xfree (debugfile); + + /* Try in the alternate directory in gdb_sysroot. */ + debugfile = build_debug_file_name (gdb_sysroot, debugdir, + altdir, debuglink, NULL); + if (separate_debug_file_exists (debugfile, crc32, objfile)) + { + do_cleanups (back_to); + return debugfile; + } + xfree (debugfile); } }