* gdb/dwarf2loc.c (read_pieced_value, write_pieced_value,
authorMatthew Gretton-Dann <matthew.gretton-dann@arm.com>
Tue, 4 May 2010 09:54:18 +0000 (09:54 +0000)
committerMatthew Gretton-Dann <matthew.gretton-dann@arm.com>
Tue, 4 May 2010 09:54:18 +0000 (09:54 +0000)
dwarf2_evaluate_loc_desc): Handle not being able to access DWARF
registers gracefully.

gdb/ChangeLog
gdb/dwarf2loc.c

index 3b144e8074248e684bb37a68e4db696c36146add..38ca84f282353178a945384b3b10b7846fb5abdc 100644 (file)
@@ -1,3 +1,9 @@
+2010-05-04  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
+
+       * 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  <matthew.gretton-dann@arm.com>
 
        * exec.c (print_section_info): Display entry point without arch 
index 8fbf6518e91b7ee086702b858fc5755c219500ac..2bd45d9edd64acea0996af4b122559eca69935f5 100644 (file)
@@ -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;