public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Question about ELF core file sections
@ 2005-11-16 15:43 Randolph Chung
  2005-11-16 15:49 ` Daniel Jacobowitz
  2005-11-16 16:14 ` Mark Kettenis
  0 siblings, 2 replies; 3+ messages in thread
From: Randolph Chung @ 2005-11-16 15:43 UTC (permalink / raw)
  To: gdb

I'm trying to get core file support working on hppa64-hp-hpux11.11. I'm 
trying to reuse the infrastructure from corelow.c and the "new" 
regset_from_core_section() interface, but I'm a bit confused about how 
it's supposed to work.

corelow.c:get_core_registers() is hardcoded to look for registers in 
sections ".reg", ".reg2", ".reg-xfp" -- are these section names somehow 
standard? I don't find these documented in the ELF specs. I see that on 
Linux variants, this ".reg" section is actually synthesized by bfd. This 
all seems to be a bit convoluted :(

On HPUX, there is a program header type HP_CORE_PROC that points to a 
datastructure with the register info. Is there anyway to use the 
existing interface to get to this info? If not, it looks like I can get 
it to work using core_vec, but that uses an interface that is marked 
deprecated....

Any hints and help appreciated...

randolph

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question about ELF core file sections
  2005-11-16 15:43 Question about ELF core file sections Randolph Chung
@ 2005-11-16 15:49 ` Daniel Jacobowitz
  2005-11-16 16:14 ` Mark Kettenis
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Jacobowitz @ 2005-11-16 15:49 UTC (permalink / raw)
  To: Randolph Chung; +Cc: gdb

On Wed, Nov 16, 2005 at 11:43:48PM +0800, Randolph Chung wrote:
> I'm trying to get core file support working on hppa64-hp-hpux11.11. I'm 
> trying to reuse the infrastructure from corelow.c and the "new" 
> regset_from_core_section() interface, but I'm a bit confused about how 
> it's supposed to work.
> 
> corelow.c:get_core_registers() is hardcoded to look for registers in 
> sections ".reg", ".reg2", ".reg-xfp" -- are these section names somehow 
> standard? I don't find these documented in the ELF specs. I see that on 
> Linux variants, this ".reg" section is actually synthesized by bfd. This 
> all seems to be a bit convoluted :(

They aren't section names at all.  Core files don't have sections, only
segments.  They're a purely BFD-internal convention.

> On HPUX, there is a program header type HP_CORE_PROC that points to a 
> datastructure with the register info. Is there anyway to use the 
> existing interface to get to this info? If not, it looks like I can get 
> it to work using core_vec, but that uses an interface that is marked 
> deprecated....

You play the same tricks in BFD that ELF does, probably :-)

Alternatively you query the program headers to do it, but the existing
GDB<->BFD interface is very section-oriented.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question about ELF core file sections
  2005-11-16 15:43 Question about ELF core file sections Randolph Chung
  2005-11-16 15:49 ` Daniel Jacobowitz
@ 2005-11-16 16:14 ` Mark Kettenis
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Kettenis @ 2005-11-16 16:14 UTC (permalink / raw)
  To: randolph; +Cc: gdb

> Date: Wed, 16 Nov 2005 23:43:48 +0800
> From: Randolph Chung <randolph@tausq.org>
> 
> I'm trying to get core file support working on hppa64-hp-hpux11.11. I'm 
> trying to reuse the infrastructure from corelow.c and the "new" 
> regset_from_core_section() interface, but I'm a bit confused about how 
> it's supposed to work.
> 
> corelow.c:get_core_registers() is hardcoded to look for registers in 
> sections ".reg", ".reg2", ".reg-xfp" -- are these section names somehow 
> standard? I don't find these documented in the ELF specs. I see that on 
> Linux variants, this ".reg" section is actually synthesized by bfd. This 
> all seems to be a bit convoluted :(

The names are largely hostoric (and I'd really like to rename ".reg2"
to something more sensible).  The mechanism is there more for the
benefit of binutils than for gdb I think.  By synthesising those
section you can inspect and manipulate them with objdump for example.

> On HPUX, there is a program header type HP_CORE_PROC that points to a 
> datastructure with the register info. Is there anyway to use the 
> existing interface to get to this info? If not, it looks like I can get 
> it to work using core_vec, but that uses an interface that is marked 
> deprecated....

You'll need to write code in BFD to synthesise the ".reg" and ".reg2"
sections.  Code for 32-bit HP-UX (SOM) code files is already there in
bfd/hpux-core.c, but that code doesn't work for cross debugging.

> Any hints and help appreciated...

I think m68kbsd-tdep.c provides a pretty clean implementation
implementation of what needs to implemented on gdb's side.  Take a
look at m68kbsd_supply_fpregset() and m68kbsd_supply_gregset(), how
they're used in m68kbsd_gregset and m68kbsd_fpregset, and check out
m68kbsd_regset_from_core_section.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-11-16 16:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-16 15:43 Question about ELF core file sections Randolph Chung
2005-11-16 15:49 ` Daniel Jacobowitz
2005-11-16 16:14 ` Mark Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).