From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9316 invoked by alias); 10 Jun 2009 22:07:26 -0000 Received: (qmail 9302 invoked by uid 22791); 10 Jun 2009 22:07:25 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 10 Jun 2009 22:07:19 +0000 Received: (qmail 3482 invoked from network); 10 Jun 2009 22:07:15 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 10 Jun 2009 22:07:15 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [patch] solib-svr4.c - allow reading linkmap info from core without executable Date: Wed, 10 Jun 2009 22:07:00 -0000 User-Agent: KMail/1.9.10 Cc: Aleksandar Ristovski References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906102308.29638.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-06/txt/msg00278.txt.bz2 On Friday 29 May 2009 21:41:52, Aleksandar Ristovski wrote: > Hello, > > This small patch allows solib-svr4.c to attempt to read > linkmap info from core file when executable binary is not given. > > e.g.: > $ gdb --core testsuite/gdb.base/bigcore.corefile > ... > (gdb) info sharedlibrary > No shared libraries loaded at this time. > (gdb) > > after patch: > > $ ./gdb --nx --core testsuite/gdb.base/bigcore.corefile > GNU gdb (GDB) 6.8.50.20090529-cvs > ... > (gdb) info shared > From To Syms Read Shared Object Library > 0x4cb3e470 0x4cb58844 No /lib/libm.so.6 > 0x4ca18dd0 0x4cafe490 No /lib/libc.so.6 > 0x4c9e5880 0x4c9fa8ef No /lib/ld-linux.so.2 > (gdb) Cool. > if (info->debug_base == 0 && svr4_have_link_map_offsets ()) > { > - if (exec_bfd != NULL > + if ((exec_bfd != NULL > && bfd_get_flavour (exec_bfd) == bfd_target_elf_flavour) > + || (core_bfd != NULL > + && bfd_get_flavour (core_bfd) == bfd_target_elf_flavour)) > info->debug_base = elf_locate_base (); > } Are there live debugging cases (archs?, PIE?) (e.g., "target remote" without specifying an executable) where letting elf_locate_base try to read the debug base from the target's auxv (scan_dyntag_auxv) will work? It would mean that removing the exec_bfd checks instead of adding core_bfd checks, would still improve your case, while letting other cases benefit as well. -- Pedro Alves