Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Abhijit Ray Chaudhury <abhijit.ray.chaudhury@gmail.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb@sourceware.org
Subject: Re: Fwd: Question regarding core dump debugging using gdb on armv4
Date: Mon, 08 Apr 2013 03:27:00 -0000	[thread overview]
Message-ID: <CAACKNgW8d3qiYb1ao6+V3XpOJc7hnxY9oDAhUPD5LXjoxEYeyQ@mail.gmail.com> (raw)
In-Reply-To: <515D459A.9080802@redhat.com>

Pedro,

That is exactly what I wanted to do. I want get back traces of all the
running treads and the stack variables.

I would dump the NOTE PHDRS, which has NT_PRSTATTUS, NT_PRPSINFO,
NT_AUXV and a bunch of NT_PRSTATUS structures.
Then I need to decide which of the PHDRS ( which are of load type) ,
to be dumped.

From your answer it looked like I need lot of ELF parsing , so I think
I need to invoke user level program when core dump happens.

Do you know of any documents describing the shared object loading
process by gdb from core files ?

Thanks in advance,
-Abhijit

On Thu, Apr 4, 2013 at 2:49 PM, Pedro Alves <palves@redhat.com> 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
>


  reply	other threads:[~2013-04-08  3:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAACKNgWzC9t=OeO1N=EpoDGHtb5L6HssehYmEBJEuLC71O9hmQ@mail.gmail.com>
     [not found] ` <CAACKNgVpk_JE_vOnB+3D3XVh=mE7Gww8nKpWQ3JOYwzmnXsApQ@mail.gmail.com>
2013-04-04  3:30   ` Abhijit Ray Chaudhury
2013-04-04  9:19     ` Pedro Alves
2013-04-08  3:27       ` Abhijit Ray Chaudhury [this message]
2013-04-08 16:37         ` Pedro Alves
2013-04-08 16:56         ` Pedro Alves
2013-04-08  3:54       ` Abhijit Ray Chaudhury
2013-04-08 16:48         ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAACKNgW8d3qiYb1ao6+V3XpOJc7hnxY9oDAhUPD5LXjoxEYeyQ@mail.gmail.com \
    --to=abhijit.ray.chaudhury@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox