This is the mail archive of the gdb@sourceware.org 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: new port


> I think of a solution for (2):
> As I know PC, I can compute how many saved regs pushes
> have been already done. Then,
> or1k_unwind_sp (gdbarch, next_frame) + NUM_PUSHES * REG_SIZE
> gives me the SP when entering the function (falling stack).

That should correct, provided that your description of the frame
is correct. There's a somewhat similar situation with i386-tdep.c:
Normally, the frame pointer holds the frame address, but sometimes
functions are "frameless", and so we compute the frame base using
the stack pointer (your this_sp) and the frame size.  What's also
interesting with x86 is that, even when the frame uses a frame
pointer, the frame base address is actually an offset from what
that register contains (I think the offset is +8.  What I'm trying
to say is that, in the x86 case, the frame base is never the
content of a register, and that's not a necessity.

> (1) So I cannot find the base:
> trad_frame_set_this_base (info, this_sp);
> is not correct (the base is the final value, this_sp is not the final value).

This is related to your question above: You need to provide the value
of the frame base, which apparently is the value of the SP at the time
the function was entered.  It doesn't need to be the value of any given
register.

-- 
Joel


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