This is the mail archive of the gdb-patches@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: [CRIS] dwarf2 frame sniffer problem?


I don't know if this is related to the previous suggested problem (i.e. the dwarf2 information being wrong), but I changed the test program slightly to:

void bar(void) {}
void foo(void)
{
  bar();
}
int main ()
{
  foo();
  return 0;
}

Now foo is no longer a leaf function, and thus saves the return address on the stack in its prologue. Stepping over foo ("next" in main) causes a breakpoint to be set at the first instruction in foo. After the target is stopped at that instruction (which is where the return address is pushed on the stack) dwarf2_frame_prev_register is called, which thinks that the PC is saved on the stack (case DWARF2_FRAME_REG_SAVED_OFFSET) and reads it from there. Obviously the value it reads is wrong, since the return address hasn't been pushed yet.

What's wrong here? Is the dwarf2 debug information wrong, or should dwarf2_frame_prev_register not have been called while still in the prologue?

--
Orjan Friberg
Axis Communications


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