From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22535 invoked by alias); 8 Apr 2013 03:54:49 -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 22523 invoked by uid 89); 8 Apr 2013 03:54:48 -0000 X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_STOCKGEN,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE autolearn=no version=3.3.1 Received: from mail-vb0-f45.google.com (HELO mail-vb0-f45.google.com) (209.85.212.45) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 08 Apr 2013 03:54:48 +0000 Received: by mail-vb0-f45.google.com with SMTP id w15so3438495vbf.18 for ; Sun, 07 Apr 2013 20:54:46 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.52.249.105 with SMTP id yt9mr12343662vdc.86.1365393286394; Sun, 07 Apr 2013 20:54:46 -0700 (PDT) Received: by 10.221.5.4 with HTTP; Sun, 7 Apr 2013 20:54:46 -0700 (PDT) In-Reply-To: <515D459A.9080802@redhat.com> References: <515D459A.9080802@redhat.com> Date: Mon, 08 Apr 2013 03:54:00 -0000 Message-ID: Subject: Re: Fwd: Question regarding core dump debugging using gdb on armv4 From: Abhijit Ray Chaudhury To: Pedro Alves Cc: gdb@sourceware.org Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2013-04/txt/msg00017.txt.bz2 Pedro, In solib-svr4.c function static CORE_ADDR elf_locate_base (void) { ... /* Find DT_DEBUG. */ if (scan_dyntag (DT_DEBUG, exec_bfd, &dyn_ptr) || scan_dyntag_auxv (DT_DEBUG, &dyn_ptr)) return dyn_ptr; /* This may be a static executable. Look for the symbol conventionally named _r_debug, as a last resort. */ msymbol = lookup_minimal_symbol ("_r_debug", NULL, symfile_objfile); if (msymbol != NULL) return SYMBOL_VALUE_ADDRESS (msymbol); Are you asking me going through this section of the code ? Thanks, -Abhijit On Thu, Apr 4, 2013 at 2:49 PM, Pedro Alves wrote: > 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 >