* dwarf2-frame.c (execute_cfa_program): Complain if we encounter a
authorMark Kettenis <kettenis@gnu.org>
Sat, 1 May 2004 09:52:47 +0000 (09:52 +0000)
committerMark Kettenis <kettenis@gnu.org>
Sat, 1 May 2004 09:52:47 +0000 (09:52 +0000)
DW_CFA_restore state without a matching DW_CFA_remember_state
instead of aborting.  Fixes PR backtrace/1589.

gdb/ChangeLog
gdb/dwarf2-frame.c

index 3adcd0d..937b6f3 100644 (file)
@@ -1,3 +1,9 @@
+2004-05-01  Mark Kettenis  <kettenis@gnu.org>
+
+       * dwarf2-frame.c (execute_cfa_program): Complain if we encounter a
+       DW_CFA_restore state without a matching DW_CFA_remember_state
+       instead of aborting.  Fixes PR backtrace/1589.
+
 2004-04-30  Joel Brobecker  <brobecker@gnat.com>
 
        * MAINTAINERS: Add self as AIX maintainer.
index 13c836e..fafc8fc 100644 (file)
@@ -372,11 +372,17 @@ execute_cfa_program (unsigned char *insn_ptr, unsigned char *insn_end,
              {
                struct dwarf2_frame_state_reg_info *old_rs = fs->regs.prev;
 
-               gdb_assert (old_rs);
-
-               xfree (fs->regs.reg);
-               fs->regs = *old_rs;
-               xfree (old_rs);
+               if (old_rs == NULL)
+                 {
+                   complaint (&symfile_complaints, "\
+bad CFI data; mismatched DW_CFA_restore_state at 0x%s", paddr (fs->pc));
+                 }
+               else
+                 {
+                   xfree (fs->regs.reg);
+                   fs->regs = *old_rs;
+                   xfree (old_rs);
+                 }
              }
              break;