From: Matthew Gretton-Dann Date: Tue, 4 May 2010 09:54:18 +0000 (+0000) Subject: * gdb/dwarf2loc.c (read_pieced_value, write_pieced_value, X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=63b4f126d12867bff0f4e8dd37e4c11129f1ba87;p=binutils-gdb.git * gdb/dwarf2loc.c (read_pieced_value, write_pieced_value, dwarf2_evaluate_loc_desc): Handle not being able to access DWARF registers gracefully. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3b144e80742..38ca84f2823 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2010-05-04 Matthew Gretton-Dann + + * dwarf2loc.c (read_pieced_value, write_pieced_value, + dwarf2_evaluate_loc_desc): Handle not being able to access DWARF + registers gracefully. + 2010-05-04 Matthew Gretton-Dann * exec.c (print_section_info): Display entry point without arch diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 8fbf6518e91..2bd45d9edd6 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -284,8 +284,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; @@ -356,8 +364,16 @@ write_pieced_value (struct value *to, struct value *from) /* 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: @@ -454,7 +470,16 @@ dwarf2_evaluate_loc_desc (struct symbol *var, struct frame_info *frame, 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 (SYMBOL_TYPE (var), gdb_regnum, frame); + if (gdb_regnum != -1) + { + retval = value_from_register (SYMBOL_TYPE (var), + gdb_regnum, frame); + } + else + { + error (_("Unable to access DWARF register number %s"), + paddress (arch, dwarf_regnum)); + } } break;