New OPTIMIZED_OUT_ERROR error code.
authorPedro Alves <palves@redhat.com>
Fri, 6 Dec 2013 19:48:54 +0000 (19:48 +0000)
committerPedro Alves <palves@redhat.com>
Fri, 6 Dec 2013 19:48:54 +0000 (19:48 +0000)
In order to catch <optimized out> errors like we catch <unavailable>
errors, this adds a new OPTIMIZED_OUT_ERROR error code, and throws it
in various places.

gdb/ChangeLog
2013-12-06  Andrew Burgess  <aburgess@broadcom.com>
    Pedro Alves  <palves@redhat.com>

* exceptions.h (errors): Add OPTIMIZED_OUT_ERROR.
* dwarf2loc.c (write_pieced_value): Throw OPTIMIZED_OUT_ERROR.
* frame.c (frame_unwind_register): Throw OPTIMIZED_OUT_ERROR.
* spu-tdep.c (spu_software_single_step): Throw
OPTIMIZED_OUT_ERROR.
* valops.c (value_assign): Throw OPTIMIZED_OUT_ERROR.

gdb/ChangeLog
gdb/dwarf2loc.c
gdb/exceptions.h
gdb/frame.c
gdb/spu-tdep.c
gdb/valops.c

index 464601a878d01ad4a7f2a599dbd3eb3cd162b296..911131410a17060dd435bb986c696cb177cc13c3 100644 (file)
@@ -1,3 +1,13 @@
+2013-12-06  Andrew Burgess  <aburgess@broadcom.com>
+           Pedro Alves  <palves@redhat.com>
+
+       * exceptions.h (errors): Add OPTIMIZED_OUT_ERROR.
+       * dwarf2loc.c (write_pieced_value): Throw OPTIMIZED_OUT_ERROR.
+       * frame.c (frame_unwind_register): Throw OPTIMIZED_OUT_ERROR.
+       * spu-tdep.c (spu_software_single_step): Throw
+       OPTIMIZED_OUT_ERROR.
+       * valops.c (value_assign): Throw OPTIMIZED_OUT_ERROR.
+
 2013-12-06  Tom Tromey  <tromey@redhat.com>
 
        * objfiles.c (free_objfile): Update comment.
index 2d15546f59625937d094769f161c2e9e5fc3a7b5..2b1f32314a8feefb2d0378de980cea9e56cf66d0 100644 (file)
@@ -1893,9 +1893,10 @@ write_pieced_value (struct value *to, struct value *from)
                                                   &optim, &unavail))
                      {
                        if (optim)
-                         error (_("Can't do read-modify-write to "
-                                  "update bitfield; containing word has been "
-                                  "optimized out"));
+                         throw_error (OPTIMIZED_OUT_ERROR,
+                                      _("Can't do read-modify-write to "
+                                        "update bitfield; containing word "
+                                        "has been optimized out"));
                        if (unavail)
                          throw_error (NOT_AVAILABLE_ERROR,
                                       _("Can't do read-modify-write to update "
index a3a28f4898d1a233470a43f8cfcc7183f32c70a1..705f1a1f617dbbfab76fb16c6cc335523aca9785 100644 (file)
@@ -86,6 +86,10 @@ enum errors {
      traceframe.  */
   NOT_AVAILABLE_ERROR,
 
+  /* Value was optimized out.  Note: if the value was a register, this
+     means the register was not saved in the frame.  */
+  OPTIMIZED_OUT_ERROR,
+
   /* DW_OP_GNU_entry_value resolving failed.  */
   NO_ENTRY_VALUE_ERROR,
 
index 576c9697c1b015d044cb5953115c05587bb15c6e..0ba1d4dfb415f202137c370405de7160000623d2 100644 (file)
@@ -1007,7 +1007,8 @@ frame_unwind_register (struct frame_info *frame, int regnum, gdb_byte *buf)
                         &lval, &addr, &realnum, buf);
 
   if (optimized)
-    error (_("Register %d was not saved"), regnum);
+    throw_error (OPTIMIZED_OUT_ERROR,
+                _("Register %d was not saved"), regnum);
   if (unavailable)
     throw_error (NOT_AVAILABLE_ERROR,
                 _("Register %d is not available"), regnum);
index fd54b1e217aa7e8ed983a3fd0ba7e681bed5a2de..fdf435e10b569e07efec856cceed12171bcf6873 100644 (file)
@@ -1614,8 +1614,9 @@ spu_software_single_step (struct frame_info *frame)
          else
            {
              if (optim)
-               error (_("Could not determine address of "
-                        "single-step breakpoint."));
+               throw_error (OPTIMIZED_OUT_ERROR,
+                            _("Could not determine address of "
+                              "single-step breakpoint."));
              if (unavail)
                throw_error (NOT_AVAILABLE_ERROR,
                             _("Could not determine address of "
index 8e7b16fb9a09f00ae282424815f7f13e0f871b1b..d43c75827f0ba4830cf7cf440d66b3aa2bf847a7 100644 (file)
@@ -1188,7 +1188,8 @@ value_assign (struct value *toval, struct value *fromval)
                                               &optim, &unavail))
                  {
                    if (optim)
-                     error (_("value has been optimized out"));
+                     throw_error (OPTIMIZED_OUT_ERROR,
+                                  _("value has been optimized out"));
                    if (unavail)
                      throw_error (NOT_AVAILABLE_ERROR,
                                   _("value is not available"));