This is the mail archive of the 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)
int main ()
  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?

Does this:

        /* NOTE: cagney/2003-09-05: CFI should specify the disposition
           of all debug info registers.  If it doesn't, complain (but
           not too loudly).  It turns out that GCC assumes that an
           unspecified register implies "same value" when CFI (draft
           7) specifies nothing at all.  Such a register could equally
           be interpreted as "undefined".  Also note that this check
           isn't sufficient; it only checks that all registers in the
           range [0 .. max column] are specified, and won't detect
           problems when a debug info register falls outside of the
           table.  We need a way of iterating through all the valid
           DWARF2 register numbers.  */
        if (fs->regs.reg[column].how == DWARF2_FRAME_REG_UNSPECIFIED)
          complaint (&symfile_complaints,
                     "Incomplete CFI data; unspecified registers at 0x%s",
                     paddr (fs->pc));
          cache->reg[regnum] = fs->regs.reg[column];

sound like your problem? It's possible to specify initial values of such registers with:

/* Set the architecture-specific register state initialization
   function for GDBARCH to INIT_REG.  */

extern void dwarf2_frame_set_init_reg (struct gdbarch *gdbarch,
void (*init_reg) (struct gdbarch *, int,
struct dwarf2_frame_state_reg *));


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