From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19023 invoked by alias); 29 May 2009 20:42:17 -0000 Received: (qmail 19013 invoked by uid 22791); 29 May 2009 20:42:16 -0000 X-SWARE-Spam-Status: No, hits=-3.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 29 May 2009 20:42:11 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MA8tz-00056e-2j for gdb-patches@sources.redhat.com; Fri, 29 May 2009 20:42:07 +0000 Received: from enigma.qnx.com ([209.226.137.106]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 29 May 2009 20:42:07 +0000 Received: from aristovski by enigma.qnx.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 29 May 2009 20:42:07 +0000 To: gdb-patches@sources.redhat.com From: Aleksandar Ristovski Subject: [patch] solib-svr4.c - allow reading linkmap info from core without executable Date: Fri, 29 May 2009 20:42:00 -0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010509040809080607050509" User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) 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-05/txt/msg00630.txt.bz2 This is a multi-part message in MIME format. --------------010509040809080607050509 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 820 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) Thanks, -- Aleksandar Ristovski QNX Software Systems ChangeLog: * solib-svr4.c (IGNORE_FIRST_LINK_MAP_ENTRY): Avoid dereferencing NULL pointer. (locate_base): If exec_bfd is NULL, use core_bfd if. --------------010509040809080607050509 Content-Type: text/plain; name="solib-svr4-bettercore-20090529.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="solib-svr4-bettercore-20090529.patch" Content-length: 1112 Index: gdb/solib-svr4.c =================================================================== RCS file: /cvs/src/src/gdb/solib-svr4.c,v retrieving revision 1.100 diff -u -p -r1.100 solib-svr4.c --- gdb/solib-svr4.c 22 May 2009 23:49:13 -0000 1.100 +++ gdb/solib-svr4.c 29 May 2009 20:34:49 -0000 @@ -266,7 +266,7 @@ IGNORE_FIRST_LINK_MAP_ENTRY (struct so_l /* Assume that everything is a library if the dynamic loader was loaded late by a static executable. */ - if (bfd_get_section_by_name (exec_bfd, ".dynamic") == NULL) + if (exec_bfd && bfd_get_section_by_name (exec_bfd, ".dynamic") == NULL) return 0; return extract_typed_address (so->lm_info->lm + lmo->l_prev_offset, @@ -826,8 +826,10 @@ locate_base (struct svr4_info *info) 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 (); } return info->debug_base; --------------010509040809080607050509--