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


Hi,

Jeremy,

I try to rewrite my target-tdep.c from the beginning taking
or1k-tdep.c as a template.

In the function or1k_frame_unwind_cache,
you get SP that way:
this_sp = or1k_unwind_sp (gdbarch, next_frame);

But this function could be called at any step of the prologue.
As SP is added the frame size at the beginning of the prologue,
I think this_sp is always the good value (the base). But in my case,
the prologue begins by pushing saved registers and then
SP changes at every step. So if I get SP by doing
this_sp = or1k_unwind_sp (gdbarch, next_frame);
I get the SP value at this step of the execution, not the final value.

(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).

(2) Plus, I need the SP when entering the called function because
this is where PREVIOUS PC is saved.

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).

Do you think this solution is ok?

Have you an idea for the issue (1) ?

Thank you.

Regards.

Florent


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