This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] DW_CFA_restore handling causes memory fault
On Fri, 2005-11-18 at 14:45 +0100, Mark Kettenis wrote:
> Formatted in what way? Starting in column 0? Well, that's because
> it's easier to see whether the string will be longer than 80
> characters, which your string will be once the %s is filled in.
I just noticed that other complaints of the file will wrap because
symfile complaints are prefixed with 'During symbol reading, '. I put
the line break in my patch so that the first line is no longer that 80
chars with the prefix.
> So
> could you split the string over two lines? You're going to have to do
> that anyway, because I'm going to ask you to make a little change: can
> you also print the register number for the register that the complaint
> is about?
Here's the latest version of the patch with the regnum printed out. Is
it ok to commit ?
Fred.
2005-11-23 FrÃdÃric Riss <frederic.riss@st.com>
* dwarf2-frame.c: (execute_cfa_program): Don't access
past the allocated dwarf2_frame_state.initial.regs.
--- dwarf2-frame.c.orig 2005-11-23 10:19:31.000000000 +0100
+++ dwarf2-frame.c 2005-11-23 10:28:22.000000000 +0100
@@ -294,7 +294,16 @@ execute_cfa_program (gdb_byte *insn_ptr,
gdb_assert (fs->initial.reg);
reg = insn & 0x3f;
dwarf2_frame_state_alloc_regs (&fs->regs, reg + 1);
- fs->regs.reg[reg] = fs->initial.reg[reg];
+ if (reg < fs->initial.num_regs)
+ fs->regs.reg[reg] = fs->initial.reg[reg];
+ else
+ fs->regs.reg[reg].how = DWARF2_FRAME_REG_UNSPECIFIED;
+
+ if (fs->regs.reg[reg].how == DWARF2_FRAME_REG_UNSPECIFIED)
+ complaint (&symfile_complaints, _(
+"incomplete CFI data; DW_CFA_restore of unspecified\n"
+"registers (e.g., regnum %i) at 0x%s"),
+ DWARF2_REG_TO_REGNUM(reg), paddr (fs->pc));
}
else
{