This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: dwarf2 frame unwinder assumptions on SP


> > > > Currently, in my x-tdep.c I have:
> > > >   set_gdbarch_unwind_pc(gdbarch, x_unwind_pc);
> > > >   frame_unwind_append_sniffer (gdbarch, 
> > >
> > > It sounds like you need to set a "frame base" sniffer also, other than
> > > the dwarf one.  The dwarf2 frame unwinder does not set anything related
> > > to the "frame base" used by symbolic debug information; it only unwinds
> > > the stack pointer as best it can.
> > >
> > > Does "print $sp" work correctly when unwinding?
> > >
> >
> > At frame #0, it's OK, at frame #1 it is not (it displays CFA).
> 
> Then you've got an unwinding problem.  Your unwind information is not
> providing adequate information to recreate the value of $sp, so
> adjusting the frame base isn't going to help after all.
> 
> You probably want to provide an init_reg method which does something
> clever with SP_REGNUM.  You may get the easiest results by adjusting
> DWARF2_FRAME_REG_CFA to support an offset, i.e., set $sp to the value
> of the CFA plus some fixed offset.
> 

I don't see what to do in init_reg without adding a new value to the
dwarf2_frame_reg_rule enum. Do you mean changing the semantics of
DWARF2_FRAME_REG_CFA and provide a frame_prev_register() method
to interpret it accordingly?

If the latter, it also means I have to write a specific frame_sniffer()
to return the frame_unwind struct pointing to my frame_prev_register()
method, right?

Then, it sounds like my frame_sniffer() should replace
dwarf2_frame_sniffer()
but use the same code, as I only want to replace frame_prev_register().
Am I right?

Thanks,

Christophe.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]