* elf core file format for powerpc
@ 2008-02-05 13:07 rahul dev
2008-02-05 13:19 ` Daniel Jacobowitz
0 siblings, 1 reply; 8+ messages in thread
From: rahul dev @ 2008-02-05 13:07 UTC (permalink / raw)
To: gdb
Guys,
I am working on embedded system (powerpc based). I try to collect the memory dump over the UART and save it to file.
Next, I convert this raw data to the core file and try to analyse the contents of various global variables. gdb shows perfect results for all the variables in .data and .bss sections.
However, I do not know how to see the values of various general purpose registers and stack dump.
I generally get the following message:
warning: Couldn't find general-purpose registers in core file
It looks that the gdb try to find the ".reg" section in the core file, but it couldn't find it. I tried adding a .reg section with the register contents, still I get the same error message.
Is there ant utility by which I can add a ".reg" section to the corefile.
Also, is anyone aware of any link that describes the core file format (elf, linux over powerpc) ? I particulary need information about "note0, .reg, .reg2" sections.
Also, is the code for "gcore" available on the internet. I need the source code for "gcore" that creates a core file in elf format and also adds sections "note0, .reg, .reg2".
I would be highly grateful for any help/pointers.
thanks a lot......
Forgot the famous last words? Access your message archive online at http://in.messenger.yahoo.com/webmessengerpromo.php
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: elf core file format for powerpc
2008-02-05 13:07 elf core file format for powerpc rahul dev
@ 2008-02-05 13:19 ` Daniel Jacobowitz
2008-02-05 13:26 ` rahul dev
0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2008-02-05 13:19 UTC (permalink / raw)
To: rahul dev; +Cc: gdb
On Tue, Feb 05, 2008 at 06:37:08PM +0530, rahul dev wrote:
> Also, is anyone aware of any link that describes the core file format (elf, linux over powerpc) ? I particulary need information about "note0, .reg, .reg2" sections.
You're using objdump; try using readelf instead. That gives a more
accurate picture of the contents. Then read the ELF gABI which
describes the format of core files.
> Also, is the code for "gcore" available on the internet. I need the
> source code for "gcore" that creates a core file in elf format and
> also adds sections "note0, .reg, .reg2".
Of course it is. It's in the source package for GDB. But it uses the
BFD library, so it's a little complicated to find out where each piece
is implemented.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: elf core file format for powerpc
2008-02-05 13:19 ` Daniel Jacobowitz
@ 2008-02-05 13:26 ` rahul dev
2008-02-05 13:31 ` Daniel Jacobowitz
0 siblings, 1 reply; 8+ messages in thread
From: rahul dev @ 2008-02-05 13:26 UTC (permalink / raw)
To: gdb
Thanks for your reply.
But, is there any link/documentation that describes the core file
format for EM_PPC ?
--- On Tue, 5/2/08, Daniel Jacobowitz <drow@false.org> wrote:
> From: Daniel Jacobowitz <drow@false.org>
> Subject: Re: elf core file format for powerpc
> To: "rahul dev" <rahul_dev_agg@yahoo.co.in>
> Cc: gdb@sourceware.org
> Date: Tuesday, 5 February, 2008, 6:49 PM
> On Tue, Feb 05, 2008 at 06:37:08PM +0530, rahul dev wrote:
> > Also, is anyone aware of any link that describes the
> core file format (elf, linux over powerpc) ? I particulary
> need information about "note0, .reg, .reg2"
> sections.
>
> You're using objdump; try using readelf instead. That
> gives a more
> accurate picture of the contents. Then read the ELF gABI
> which
> describes the format of core files.
>
> > Also, is the code for "gcore" available on
> the internet. I need the
> > source code for "gcore" that creates a core
> file in elf format and
> > also adds sections "note0, .reg, .reg2".
>
> Of course it is. It's in the source package for GDB.
> But it uses the
> BFD library, so it's a little complicated to find out
> where each piece
> is implemented.
>
> --
> Daniel Jacobowitz
> CodeSourcery
5, 50, 500, 5000 - Store N number of mails in your inbox. Go to http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: elf core file format for powerpc
2008-02-05 13:26 ` rahul dev
@ 2008-02-05 13:31 ` Daniel Jacobowitz
2008-02-05 13:43 ` rahul dev
0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2008-02-05 13:31 UTC (permalink / raw)
To: rahul dev; +Cc: gdb
On Tue, Feb 05, 2008 at 06:55:40PM +0530, rahul dev wrote:
> Thanks for your reply.
> But, is there any link/documentation that describes the core file
> format for EM_PPC ?
I don't know of any. Once you understand core files in general, it is
very easy. You just need a register note of the correct size.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: elf core file format for powerpc
2008-02-05 13:31 ` Daniel Jacobowitz
@ 2008-02-05 13:43 ` rahul dev
2008-02-05 19:32 ` Jim Blandy
0 siblings, 1 reply; 8+ messages in thread
From: rahul dev @ 2008-02-05 13:43 UTC (permalink / raw)
To: gdb
--- On Tue, 5/2/08, Daniel Jacobowitz <drow@false.org> wrote:
> From: Daniel Jacobowitz <drow@false.org>
> Subject: Re: elf core file format for powerpc
> To: "rahul dev" <rahul_dev_agg@yahoo.co.in>
> Cc: gdb@sourceware.org
> Date: Tuesday, 5 February, 2008, 7:00 PM
> On Tue, Feb 05, 2008 at 06:55:40PM +0530, rahul dev wrote:
> > Thanks for your reply.
> > But, is there any link/documentation that describes
> the core file
> > format for EM_PPC ?
>
> I don't know of any. Once you understand core files in
> general, it is
> very easy. You just need a register note of the correct
> size.
>
Can you please provide some information on the note section and how to
add register values in the note section. I searched a lot on the net
but failed to get any useful information.
5, 50, 500, 5000 - Store N number of mails in your inbox. Go to http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: elf core file format for powerpc
2008-02-05 13:43 ` rahul dev
@ 2008-02-05 19:32 ` Jim Blandy
2008-02-05 19:37 ` Jim Blandy
2008-02-05 19:45 ` rahul dev
0 siblings, 2 replies; 8+ messages in thread
From: Jim Blandy @ 2008-02-05 19:32 UTC (permalink / raw)
To: rahul_dev_agg; +Cc: gdb
On Feb 5, 2008 5:42 AM, rahul dev <rahul_dev_agg@yahoo.co.in> wrote:
> Can you please provide some information on the note section and how to
> add register values in the note section. I searched a lot on the net
> but failed to get any useful information.
One source of confusion is that the code in GDB that operates on BFD
sections is actually accessing ELF notes, in a PT_NOTE program header.
When BFD opens a core file and sees a PT_NOTE program header, it
turns each note into a "section" with a known name. See
bfd/elfcore.h:elf_core_file_p, and uses of
_bfd_elfcore_make_pseudosection.
So if you want to produce .reg "sections" that GDB can see, you need
to produce PT_NOTE program headers in your core that BFD will
recognize.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: elf core file format for powerpc
2008-02-05 19:32 ` Jim Blandy
@ 2008-02-05 19:37 ` Jim Blandy
2008-02-05 19:45 ` rahul dev
1 sibling, 0 replies; 8+ messages in thread
From: Jim Blandy @ 2008-02-05 19:37 UTC (permalink / raw)
To: rahul_dev_agg; +Cc: gdb
On Feb 5, 2008 11:31 AM, Jim Blandy <jimb@red-bean.com> wrote:
> One source of confusion is that the code in GDB that operates on BFD
> sections is actually accessing ELF notes, in a PT_NOTE program header.
> When BFD opens a core file and sees a PT_NOTE program header, it
> turns each note into a "section" with a known name. See
> bfd/elfcore.h:elf_core_file_p, and uses of
> _bfd_elfcore_make_pseudosection.
(Thus Daniel's recommendation that you use elfread, instead of
objdump. objdump presents BFD's point of view on the world, and
'magic' processing of this sort is pretty confusing. readelf shows
you exactly what's there.)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: elf core file format for powerpc
2008-02-05 19:32 ` Jim Blandy
2008-02-05 19:37 ` Jim Blandy
@ 2008-02-05 19:45 ` rahul dev
1 sibling, 0 replies; 8+ messages in thread
From: rahul dev @ 2008-02-05 19:45 UTC (permalink / raw)
To: gdb
--- On Wed, 6/2/08, Jim Blandy <jimb@red-bean.com> wrote:
> From: Jim Blandy <jimb@red-bean.com>
> Subject: Re: elf core file format for powerpc
> To: rahul_dev_agg@yahoo.co.in
> Cc: gdb@sourceware.org
> Date: Wednesday, 6 February, 2008, 1:01 AM
> On Feb 5, 2008 5:42 AM, rahul dev
> <rahul_dev_agg@yahoo.co.in> wrote:
> > Can you please provide some information on the note
> section and how to
> > add register values in the note section. I searched a
> lot on the net
> > but failed to get any useful information.
>
> One source of confusion is that the code in GDB that
> operates on BFD
> sections is actually accessing ELF notes, in a PT_NOTE
> program header.
> When BFD opens a core file and sees a PT_NOTE program
> header, it
> turns each note into a "section" with a known
> name. See
> bfd/elfcore.h:elf_core_file_p, and uses of
> _bfd_elfcore_make_pseudosection.
>
> So if you want to produce .reg "sections" that
> GDB can see, you need
> to produce PT_NOTE program headers in your core that BFD
> will
> recognize.
Thanks Jim. I can read the registers from the core file now.
Also, readelf was really useful, specially the -n option.
Get the freedom to save as many mails as you wish. To know how, go to http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-02-05 19:45 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-05 13:07 elf core file format for powerpc rahul dev
2008-02-05 13:19 ` Daniel Jacobowitz
2008-02-05 13:26 ` rahul dev
2008-02-05 13:31 ` Daniel Jacobowitz
2008-02-05 13:43 ` rahul dev
2008-02-05 19:32 ` Jim Blandy
2008-02-05 19:37 ` Jim Blandy
2008-02-05 19:45 ` rahul dev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox