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 Thu, 2005-11-24 at 23:48 +0100, Mark Kettenis wrote:
> Sorry to be such a prick, but could you change the message
[...]
> I think that's less confusing. With that change you've got my ok.
Well I'm sorry that you have to rewrite my patch yourself :-)
I commited the attached patch containing your message to HEAD. Should
that go to the 6.4 branch also ? BTW, what's the policy for patches
being approved during the release process, do they have implicit
approval for HEAD and the branch or does the latter require explicit
approval ?
> You're not listed in MAINTAINERS though. Do you've got a copyright
> assignment in place?
I've added myself to the 'Write after approval' section as Jim
requested. My work is covered by the STMicroelectronics copyright
assignment.
Fred.
2005-11-25 Frederic Riss <frederic.riss@st.com>
* dwarf2-frame.c: (execute_cfa_program): Don't access past the
allocated dwarf2_frame_state.initial.regs.
Index: dwarf2-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2-frame.c,v
retrieving revision 1.54
diff -u -p -r1.54 dwarf2-frame.c
--- dwarf2-frame.c 1 Aug 2005 04:06:27 -0000 1.54
+++ dwarf2-frame.c 25 Nov 2005 06:40:31 -0000
@@ -294,7 +294,17 @@ 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 unspecified\n\
+register %s (#%d) at 0x%s"),
+ REGISTER_NAME(DWARF2_REG_TO_REGNUM(reg)),
+ DWARF2_REG_TO_REGNUM(reg), paddr (fs->pc));
}
else
{