aboutsummaryrefslogtreecommitdiff
path: root/binutils/readelf.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-03-22 03:55:50 +0000
committerRichard Henderson <rth@redhat.com>2004-03-22 03:55:50 +0000
commit8c9a987975e3bda9ed098c87ece7a2140bf9fffa (patch)
treed021eb97467e43a51782c9f8d661de7d89bb2695 /binutils/readelf.c
parentb2a8e7660e6cb65f7370fd55ae0ece7bd78a99cb (diff)
downloadgdb-8c9a987975e3bda9ed098c87ece7a2140bf9fffa.zip
gdb-8c9a987975e3bda9ed098c87ece7a2140bf9fffa.tar.gz
gdb-8c9a987975e3bda9ed098c87ece7a2140bf9fffa.tar.bz2
* readelf.c (display_debug_frames): Don't crash for mismatched
DW_CFA_restore_state.
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r--binutils/readelf.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c
index ddbf781..3561eff 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -9150,13 +9150,19 @@ display_debug_frames (Elf_Internal_Shdr *section,
if (! do_debug_frames_interp)
printf (" DW_CFA_restore_state\n");
rs = remembered_state;
- remembered_state = rs->next;
- frame_need_space (fc, rs->ncols-1);
- memcpy (fc->col_type, rs->col_type, rs->ncols);
- memcpy (fc->col_offset, rs->col_offset, rs->ncols * sizeof (int));
- free (rs->col_type);
- free (rs->col_offset);
- free (rs);
+ if (rs)
+ {
+ remembered_state = rs->next;
+ frame_need_space (fc, rs->ncols-1);
+ memcpy (fc->col_type, rs->col_type, rs->ncols);
+ memcpy (fc->col_offset, rs->col_offset,
+ rs->ncols * sizeof (int));
+ free (rs->col_type);
+ free (rs->col_offset);
+ free (rs);
+ }
+ else if (do_debug_frames_interp)
+ printf ("Mismatched DW_CFA_restore_state\n");
break;
case DW_CFA_def_cfa: