#include "defs.h"
#include "arch-utils.h"
-#include "gdb_string.h"
+#include <string.h>
#include "symtab.h"
#include "gdbtypes.h"
#include "value.h"
reset, be sure to consider this use as well! */
unsigned int lazy : 1;
- /* If nonzero, this is the value of a variable which does not
- actually exist in the program. */
+ /* If nonzero, this is the value of a variable that does not
+ actually exist in the program. If nonzero, and LVAL is
+ lval_register, this is a register ($pc, $sp, etc., never a
+ program variable) that has not been saved in the frame. All
+ optimized-out values are treated pretty much the same, except
+ registers have a different string representation and related
+ error strings. */
unsigned int optimized_out : 1;
/* If value is a variable, is it initialized or not. */
return result;
}
+void
+error_value_optimized_out (void)
+{
+ error (_("value has been optimized out"));
+}
+
static void
require_not_optimized_out (const struct value *value)
{
if (value->optimized_out)
- error (_("value has been optimized out"));
+ {
+ if (value->lval == lval_register)
+ error (_("register has not been saved in frame"));
+ else
+ error_value_optimized_out ();
+ }
}
static void
\f
/* Get the value of the FIELDNO'th field (which must be static) of
- TYPE. Return NULL if the field doesn't exist or has been
- optimized out. */
+ TYPE. */
struct value *
value_static_field (struct type *type, int fieldno)
NULL, NULL);
if (!msym)
- return NULL;
+ return allocate_optimized_out_value (type);
else
{
retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno),
int ret;
if (argc != 1)
- error (_("You must provide one parameter for $_isvoid."));
+ error (_("You must provide one argument for $_isvoid."));
ret = TYPE_CODE (value_type (argv[0])) == TYPE_CODE_VOID;