Return early in target_xfer_partial when LEN is zero.
[deliverable/binutils-gdb.git] / gdb / findvar.c
index 25242bea71adb22a103e7eca4a033c5892464e67..0647c0f1331306944ca9b650829cd3e5de587f1c 100644 (file)
@@ -1,6 +1,6 @@
 /* Find a variable's value in memory, for GDB, the GNU debugger.
 
-   Copyright (C) 1986-2013 Free Software Foundation, Inc.
+   Copyright (C) 1986-2014 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -25,7 +25,7 @@
 #include "gdbcore.h"
 #include "inferior.h"
 #include "target.h"
-#include "gdb_string.h"
+#include <string.h>
 #include "gdb_assert.h"
 #include "floatformat.h"
 #include "symfile.h"           /* for overlay functions */
@@ -757,6 +757,15 @@ address_from_register (struct type *type, int regnum, struct frame_info *frame)
   value = value_from_register (type, regnum, frame);
   gdb_assert (value);
 
+  if (value_optimized_out (value))
+    {
+      /* This function is used while computing a location expression.
+        Complain about the value being optimized out, rather than
+        letting value_as_address complain about some random register
+        the expression depends on not being saved.  */
+      error_value_optimized_out ();
+    }
+
   result = value_as_address (value);
   release_value (value);
   value_free (value);
This page took 0.029938 seconds and 4 git commands to generate.