* dwarf2-frame.c: (execute_cfa_program): Don't access past the
authorFrederic Riss <frederic.riss@st.com>
Fri, 25 Nov 2005 06:42:07 +0000 (06:42 +0000)
committerFrederic Riss <frederic.riss@st.com>
Fri, 25 Nov 2005 06:42:07 +0000 (06:42 +0000)
allocated dwarf2_frame_state.initial.regs.

gdb/ChangeLog
gdb/dwarf2-frame.c

index dd8067f083fabdfa27dba833da79ba94f1a82d30..de1c5c385477c53a9ca20471c0548d4fe59524d0 100644 (file)
@@ -1,3 +1,8 @@
+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.
+
 2005-11-25 Frederic Riss <frederic.riss@st.com>
        
        * MAINTAINERS (Write After Approval): Add myself to the list.
index ef0d6266fd83179886f0bd21a584f06ec6a523e7..c65967fcff4fca2d2e4562f7a4758bb7e8a4dd71 100644 (file)
@@ -294,7 +294,17 @@ execute_cfa_program (gdb_byte *insn_ptr, gdb_byte *insn_end,
          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
        {