This is the mail archive of the gdb-patches@sourceware.org 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: [RFC] DW_CFA_restore handling causes memory fault


On Fri, 2005-11-18 at 00:35 -0800, Jim Blandy wrote:
> Yes!  But --- I apologize for not noticing this from the beginning ---
> as I see your comment, it occurs to me that probably a call to
> 'complaint' would be better than just a comment.  Mark or Daniel can
> string me up if they feel this will yield another 'incomplete CFI
> data; unspecified blah blah blah' annoyance, but I think it's probably
> the right thing.

OK, third try attached. I mimiced the formatting of other complaints of
the file. I didn't put the complaint in the 'else' clause, but added a
check after the whole 'if', because an allocated register state isn't
necessarily set to a correct value.

Just a question: why are the i18n'ified strings formatted this way ?

>  If you're doing this as part of your paying
> job, then the assignment from STMicroelectronics already on file

That's the case.

> For the sourceware account, see
> http://sourceware.org/cgi-bin/pdw/ps_form.cgi.  List me as the person
> approving the request.

I'll do the request this evening (setting up the CVS access from work
will take some time, I'll use my home box for this patch.)

Thanks,
Fred.

2005-11-17  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.


Index: dwarf2-frame.c
===================================================================
--- dwarf2-frame.c	(revision 98)
+++ dwarf2-frame.c	(working copy)
@@ -294,8 +294,16 @@
 	  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 register state at 0x%s."),
+		       paddr (fs->pc));
 	}
       else
 	{

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