Re: [PATCH RFC] DWARF2 CFI exploitation for Linux on S/390

Andrew Cagney
2002-09-27T02:54:56Z

> In order to adapt the code to the first item, I have introduced #defines
> for DWARF2 registers and a REGNUM_TO_DWARF2_REG macro and its
> implementation. See the attached patch for details.

Looking just at the gdbarch.h addition REGNUM_TO_DWARF2_REG(). Is it
possible to compute this using DWARF2_REGNUM_TO_REGNUM() or [better?]
have dwarf2cfi convert everything to GDB regnums. Having everything in
GDB REGNUM's would take away any need for conversion confusion.

Also note:
http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=325

The current code contains things like:
int regs_size = sizeof (struct context_reg) * NUM_REGS;
but it should be using (NUM_REGS + NUM_PSEUDO_REGS) because there is a
very good chance that the REGNUM returned by DWARF2_REG_TO_REGNUM() is
in the range [NUM_REGS .. NUM_REGS+NUM_PSEUD_REGS).

> In order to consider the second item I have adapted the LOC_REF_ARG symbol
> class handling in dwarf2read.c and findvar.c to use the BASEREG value if
> DWARF2 is active.

>>
>> Finally I am interested in how signal frame and dummy frame handling is
>> supposed to work with DWARF2 CFI support. Does anybody have done already
>> work in this area?
>>

> That's the question I'm solving too. The first approach (for x86-64) is here: http://sources.redhat.com/ml/gdb-patches/2002-09/msg00384.html
> Basically I don't set_gdbarch_*() directly to cfi_*() functions but instead to corresponding x86_64_*() functions, that eventually call cfi_*() themselves. For sighandler caller frames I'm afraid I'll have to manually fill appropriate structures in struct context (probably in those x86_64_*() functions).

See: http://sources.redhat.com/ml/gdb/2002-09/msg00301.html

The theory is that each frame has frame specific methods:
register-unwind, saved-pc (and frame-chain(?)).

So far a recursive frame->unwind() method has been added and all
evidence suggests it is working well. The CFI code needs to be updated
to work with that interface, and also work with the current
regcache.[hc] interface.

enjoy,
Andrew