From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13999 invoked by alias); 4 Apr 2013 09:19:28 -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 13989 invoked by uid 89); 4 Apr 2013 09:19:27 -0000 X-Spam-SWARE-Status: No, score=-8.9 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 04 Apr 2013 09:19:25 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r349JNC0030404 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 4 Apr 2013 05:19:23 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r349JMFw027870; Thu, 4 Apr 2013 05:19:22 -0400 Message-ID: <515D459A.9080802@redhat.com> Date: Thu, 04 Apr 2013 09:19:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 To: Abhijit Ray Chaudhury CC: gdb@sourceware.org Subject: Re: Fwd: Question regarding core dump debugging using gdb on armv4 References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-04/txt/msg00004.txt.bz2 On 04/04/2013 04:30 AM, Abhijit Ray Chaudhury wrote: > Hi , > > I am trying to reduce core dump size on target running linux . The > processor is armv4 family. I tweak elf_core_dump function of linux > kernel 2.6.23. > > I tweaked the kernel to dump only elf note, registers and stack > segments of the running process. > > But gdb fails to load required shared object files and fails to give > the backtraces of the running process. > > Could you please help me ascertain how gdb loads the required > libraries from the core dump. Which ELF section of the core contains > the information ? GDB reads the load map off of structures in the dynamic loader (which runs in userspace). The dynamic loader->debugger interface has a 'struct r_debug' structure in memory that holds the list of loaded libraries. You need to preserve that and whatever it references in the core. In dynamic executables you can find where r_debug is by consulting the DT_DEBUG dyntag, found in the .dynamic section of the executable, which in turn can be found in the PT_DYNAMIC program header, which is found by scanning the OS auxiliary vector, which the kernel has access to. All this can be seen in action in gdb's solib-svr4.c. Dumping all of libc's memory may work too.. -- Pedro Alves