/* 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.
#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 */
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);