gdb/
authorPedro Alves <palves@redhat.com>
Fri, 18 Mar 2011 18:43:33 +0000 (18:43 +0000)
committerPedro Alves <palves@redhat.com>
Fri, 18 Mar 2011 18:43:33 +0000 (18:43 +0000)
* dwarf2loc.c (dwarf2_evaluate_loc_desc): Catch
NOT_AVAILABLE_ERROR when evaluating the location expression.

gdb/dwarf2loc.c
gdb/testsuite/ChangeLog

index 285081e472fd56b9b952042242239def23329694..9fd8df04abcb8836ed6cf736fdc58361d73e2773 100644 (file)
@@ -1076,6 +1076,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
   struct dwarf_expr_context *ctx;
   struct cleanup *old_chain;
   struct objfile *objfile = dwarf2_per_cu_objfile (per_cu);
+  volatile struct gdb_exception ex;
 
   if (byte_offset < 0)
     invalid_synthetic_pointer ();
@@ -1106,7 +1107,22 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
   ctx->get_tls_address = dwarf_expr_tls_address;
   ctx->dwarf_call = dwarf_expr_dwarf_call;
 
-  dwarf_expr_eval (ctx, data, size);
+  TRY_CATCH (ex, RETURN_MASK_ERROR)
+    {
+      dwarf_expr_eval (ctx, data, size);
+    }
+  if (ex.reason < 0)
+    {
+      if (ex.error == NOT_AVAILABLE_ERROR)
+       {
+         retval = allocate_value (type);
+         mark_value_bytes_unavailable (retval, 0, TYPE_LENGTH (type));
+         return retval;
+       }
+      else
+       throw_exception (ex);
+    }
+
   if (ctx->num_pieces > 0)
     {
       struct piece_closure *c;
index 5984d2dfdde353eaf1afcc70350c517900dfa3a9..8bb59b62918cabde35ea8ee9c9fc851351babd13 100644 (file)
@@ -1,3 +1,8 @@
+2011-03-18  Pedro Alves  <pedro@codesourcery.com>
+
+       * dwarf2loc.c (dwarf2_evaluate_loc_desc): Catch
+       NOT_AVAILABLE_ERROR when evaluating the location expression.
+
 2011-03-18  Pedro Alves  <pedro@codesourcery.com>
 
        * dwarf2loc.c (read_pieced_value): Handle get_frame_register_bytes