gdb/gdb-bz589467-pieces02of4.patch
2010-07-11 18:06:33 +00:00

69 lines
2.2 KiB
Diff

commit 60d15ff6d78921d080aee681e60372abe6627570
Author: mgretton <mgretton>
Date: Tue May 4 09:54:17 2010 +0000
* gdb/dwarf2loc.c (read_pieced_value, write_pieced_value,
dwarf2_evaluate_loc_desc): Handle not being able to access DWARF
registers gracefully.
Index: gdb-7.1/gdb/dwarf2loc.c
===================================================================
--- gdb-7.1.orig/gdb/dwarf2loc.c 2010-05-25 21:35:10.000000000 +0200
+++ gdb-7.1/gdb/dwarf2loc.c 2010-05-25 21:37:32.000000000 +0200
@@ -458,8 +458,16 @@ read_pieced_value (struct value *v)
/* Big-endian, and we want less than full size. */
reg_offset = register_size (arch, gdb_regnum) - p->size;
- get_frame_register_bytes (frame, gdb_regnum, reg_offset, p->size,
- contents + offset);
+ if (gdb_regnum != -1)
+ {
+ get_frame_register_bytes (frame, gdb_regnum, reg_offset,
+ p->size, contents + offset);
+ }
+ else
+ {
+ error (_("Unable to access DWARF register number %s"),
+ paddress (arch, p->v.expr.value));
+ }
}
break;
@@ -531,8 +539,16 @@ write_pieced_value (struct value *to, st
/* Big-endian, and we want less than full size. */
reg_offset = register_size (arch, gdb_regnum) - p->size;
- put_frame_register_bytes (frame, gdb_regnum, reg_offset, p->size,
- contents + offset);
+ if (gdb_regnum != -1)
+ {
+ put_frame_register_bytes (frame, gdb_regnum, reg_offset,
+ p->size, contents + offset);
+ }
+ else
+ {
+ error (_("Unable to write to DWARF register number %s"),
+ paddress (arch, p->v.expr.value));
+ }
}
break;
case DWARF_VALUE_MEMORY:
@@ -611,7 +627,16 @@ dwarf2_evaluate_loc_desc (struct type *t
struct gdbarch *arch = get_frame_arch (frame);
CORE_ADDR dwarf_regnum = dwarf_expr_fetch (ctx, 0);
int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, dwarf_regnum);
- retval = value_from_register (type, gdb_regnum, frame);
+ if (gdb_regnum != -1)
+ {
+ retval = value_from_register (type,
+ gdb_regnum, frame);
+ }
+ else
+ {
+ error (_("Unable to access DWARF register number %s"),
+ paddress (arch, dwarf_regnum));
+ }
}
break;