This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Fwd: Question regarding core dump debugging using gdb on armv4
- From: Pedro Alves <palves at redhat dot com>
- To: Abhijit Ray Chaudhury <abhijit dot ray dot chaudhury at gmail dot com>
- Cc: gdb at sourceware dot org
- Date: Thu, 04 Apr 2013 10:19:22 +0100
- Subject: Re: Fwd: Question regarding core dump debugging using gdb on armv4
- References: <CAACKNgWzC9t=OeO1N=EpoDGHtb5L6HssehYmEBJEuLC71O9hmQ at mail dot gmail dot com> <CAACKNgVpk_JE_vOnB+3D3XVh=mE7Gww8nKpWQ3JOYwzmnXsApQ at mail dot gmail dot com> <CAACKNgXh91dW5P23pA5fwR+qSUHXbuzP1R9qMKiGbUg=qjsLTg at mail dot gmail dot com>
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