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

Andrew Cagney
2002-09-30T15:53:17Z

> What needs to be done for this in general?

The theory is that the function:

static void
set_unwind_by_pc (CORE_ADDR pc, CORE_ADDR fp,
frame_register_unwind_ftype **unwind)
{
if (!USE_GENERIC_DUMMY_FRAMES)
/* Still need to set this to something. The ``info frame'' code
calls this function to find out where the saved registers are.
Hopefully this is robust enough to stop any core dumps and
return vaguely correct values.. */
*unwind = frame_saved_regs_register_unwind;
else if (PC_IN_CALL_DUMMY (pc, fp, fp))
*unwind = generic_call_dummy_register_unwind;
else
*unwind = frame_saved_regs_register_unwind;
}

is modified so that it contains a clause like:

else if (this frame's block contains dwarf2cfi
&& this target things it works with dwarf2cfi)
*unwind = dwarf2cfi_register_unwind;

where dwarf2cfi_register_unwind() is strictly *recursive* - it uses
functions defined in frame.h when it needs a read a more inner register.
Variation on the theme might be:

else if (architecture things its got a custom unwind function for this
frame's block)
*unwind = architecture's custom unwind function

There are warts in the theory - also need to add a per-frame
frame_saved_pc() and (probably) some sort of per-frame frame_chain().
(see recent post to gdb@).

Andrew