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]

PC_REGNUM in dwarf2-frame.c


Hello,

I'm trying to figure out what to do with PC_REGNUM in:

  /* Save the register info in the cache.  */
  for (reg = 0; reg < fs->regs.num_regs; reg++)
    {
      int regnum;

      /* Skip the return address column.  */
      if (reg == fs->retaddr_column)
	continue;

      /* Use the GDB register number as index.  */
      regnum = DWARF2_REG_TO_REGNUM (reg);

      if (regnum >= 0 && regnum < num_regs)
	cache->reg[regnum] = fs->regs.reg[reg];
    }

  /* Store the location of the return addess.  If the return address
     column (adjusted) is not the same as gdb's PC_REGNUM, then this
     implies a copy from the ra column register.  */
  if (fs->retaddr_column < fs->regs.num_regs
      && fs->regs.reg[fs->retaddr_column].how != REG_UNSAVED)
    cache->reg[PC_REGNUM] = fs->regs.reg[fs->retaddr_column];
  else
    {
      reg = DWARF2_REG_TO_REGNUM (fs->retaddr_column);
      if (reg != PC_REGNUM)
	{
	  cache->reg[PC_REGNUM].loc.reg = reg;
	  cache->reg[PC_REGNUM].how = REG_SAVED_REG;
	}
    }

Rather than trying to map regaddr_column onto PC_REGNUM I think it should handle it directly vis:


- don't try to do a DWARF2_REG_TO_REGNUM() on it
- use frame_pc_unwind(next_frame) when it's unwound value is needed
- make frame_pc_unwind per-frame (again)?

The problem with PC_REGNUM is that it may not be a hard register.

Thoughts? (all my favorite architectures use stabs so I've not much to test this on).

Andrew


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