* signame.c: Include defs.h and param.h.
[deliverable/binutils-gdb.git] / gdb / value.h
index 3a14661f2f5c0b215c7285da7523212e27bc4054..e0cc0d452e08ef559a63ebc7a12684c5a0af2126 100644 (file)
@@ -1,23 +1,24 @@
 /* Definitions for values of C expressions, for GDB.
-   Copyright (C) 1986, 1987 Free Software Foundation, Inc.
+   Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
 
-GDB is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY.  No author or distributor accepts responsibility to anyone
-for the consequences of using it or for whether it serves any
-particular purpose or works at all, unless he says so in writing.
-Refer to the GDB General Public License for full details.
+This file is part of GDB.
 
-Everyone is granted permission to copy, modify and redistribute GDB,
-but only under the conditions described in the GDB General Public
-License.  A copy of this license is supposed to have been given to you
-along with GDB so you can know your rights and responsibilities.  It
-should be in a file named COPYING.  Among other things, the copyright
-notice and this notice must be preserved on all copies.
+GDB is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 1, or (at your option)
+any later version.
 
-In other words, go ahead and share GDB, but don't try to stop
-anyone else from sharing it farther.  Help stamp out software hoarding!
-*/
+GDB is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
 
+You should have received a copy of the GNU General Public License
+along with GDB; see the file COPYING.  If not, write to
+the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+
+#if !defined (VALUE_H)
+#define VALUE_H 1
 /*
  * The structure which defines the type of a value.  It should never
  * be possible for a program lval value to survive over a call to the inferior
@@ -83,15 +84,43 @@ struct value
        if you take a field of a structure that is stored in a
        register.  Shouldn't it be?  */
     short regno;
+    /* If zero, contents of this value are in the contents field.
+       If nonzero, contents are in inferior memory at address
+       in the location.address field plus the offset field
+       (and the lval field should be lval_memory).  */
+    char lazy;
+    /* If nonzero, this is the value of a variable which does not
+       actually exist in the program.  */
+    char optimized_out;
     /* Actual contents of the value.  For use of this value; setting
-       it uses the stuff above.  */
-    long contents[1];
+       it uses the stuff above.  Not valid if lazy is nonzero.
+       Target byte-order.  We force it to be aligned properly for any
+       possible value.  */
+    union {
+      long contents[1];
+      double force_double_align;
+#ifdef LONG_LONG
+      long long force_longlong_align;
+#endif
+    } aligner;
+
   };
 
 typedef struct value *value;
 
 #define VALUE_TYPE(val) (val)->type
-#define VALUE_CONTENTS(val) ((char *) (val)->contents)
+#define VALUE_LAZY(val) (val)->lazy
+/* VALUE_CONTENTS and VALUE_CONTENTS_RAW both return the address of
+   the gdb buffer used to hold a copy of the contents of the lval.  
+   VALUE_CONTENTS is used when the contents of the buffer are needed --
+   it uses value_fetch_lazy() to load the buffer from the process being 
+   debugged if it hasn't already been loaded.  VALUE_CONTENTS_RAW is 
+   used when data is being stored into the buffer, or when it is 
+   certain that the contents of the buffer are valid.  */
+#define VALUE_CONTENTS_RAW(val) ((char *) (val)->aligner.contents)
+#define VALUE_CONTENTS(val) ((void)(VALUE_LAZY(val) && value_fetch_lazy(val)),\
+                            VALUE_CONTENTS_RAW(val))
+extern int value_fetch_lazy ();
 #define VALUE_LVAL(val) (val)->lval
 #define VALUE_ADDRESS(val) (val)->location.address
 #define VALUE_INTERNALVAR(val) (val)->location.internalvar
@@ -104,18 +133,29 @@ typedef struct value *value;
 #define VALUE_REPEATED(val) (val)->repeated
 #define VALUE_REPETITIONS(val) (val)->repetitions
 #define VALUE_REGNO(val) (val)->regno
+#define VALUE_OPTIMIZED_OUT(val) ((val)->optimized_out)
+
+/* Convert a REF to the object referenced. */
+
+#define COERCE_REF(arg)    \
+{ if (TYPE_CODE ( VALUE_TYPE (arg)) == TYPE_CODE_REF)                  \
+    arg = value_at_lazy (TYPE_TARGET_TYPE (VALUE_TYPE (arg)),          \
+                        unpack_long (VALUE_TYPE (arg),                 \
+                                     VALUE_CONTENTS (arg)));}
 
 /* If ARG is an array, convert it to a pointer.
    If ARG is an enum, convert it to an integer.
+   If ARG is a function, convert it to a function pointer.
 
    References are dereferenced.  */
 
 #define COERCE_ARRAY(arg)    \
-{ if (TYPE_CODE ( VALUE_TYPE (arg)) == TYPE_CODE_REF)                  \
-    arg = value_ind (arg);                                             \
+{ COERCE_REF(arg);                                                     \
   if (VALUE_REPEATED (arg)                                             \
       || TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ARRAY)              \
     arg = value_coerce_array (arg);                                    \
+  if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_FUNC)                   \
+    arg = value_coerce_function (arg);                                  \
   if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ENUM)                  \
     arg = value_cast (builtin_type_unsigned_int, arg);                 \
 }
@@ -139,6 +179,7 @@ struct internalvar
   value value;
 };
 \f
+#include "symtab.h"
 LONGEST value_as_long ();
 double value_as_double ();
 LONGEST unpack_long ();
@@ -147,6 +188,7 @@ long unpack_field_as_long ();
 value value_from_long ();
 value value_from_double ();
 value value_at ();
+value value_at_lazy ();
 value value_from_register ();
 value value_of_variable ();
 value value_of_register ();
@@ -154,34 +196,43 @@ value read_var_value ();
 value locate_var_value ();
 value allocate_value ();
 value allocate_repeat_value ();
+value value_mark ();
+void value_free_to_mark ();
 value value_string ();
 
 value value_binop ();
 value value_add ();
 value value_sub ();
 value value_coerce_array ();
+value value_coerce_function ();
 value value_ind ();
 value value_addr ();
 value value_assign ();
 value value_neg ();
 value value_lognot ();
 value value_struct_elt (), value_struct_elt_for_address ();
-value value_field ();
+value value_field (), value_primitive_field ();
 value value_cast ();
+value value_zero ();
 value value_repeat ();
 value value_subscript ();
+value value_from_vtable_info ();
 
-value call_function ();
 value value_being_returned ();
 int using_struct_return ();
+void set_return_value ();
 
 value evaluate_expression ();
 value evaluate_type ();
 value parse_and_eval ();
 value parse_to_comma_and_eval ();
+extern CORE_ADDR parse_and_eval_address ();
+extern CORE_ADDR parse_and_eval_address_1 ();
 
 value access_value_history ();
 value value_of_internalvar ();
+void set_internalvar ();
+void set_internalvar_component ();
 struct internalvar *lookup_internalvar ();
 
 int value_equal ();
@@ -193,10 +244,48 @@ value value_of_this ();
 value value_static_field ();
 value value_x_binop ();
 value value_x_unop ();
+value value_fn_field ();
+value value_virtual_fn_field ();
 int binop_user_defined_p ();
 int unop_user_defined_p ();
+int typecmp ();
+void fill_in_vptr_fieldno ();
+int destructor_name_p ();
 
+#define value_free(val) free (val)
+void free_all_values ();
+void release_value ();
+int record_latest_value ();
+
+void registers_changed ();
 void read_register_bytes ();
+void write_register_bytes ();
+void read_register_gen ();
+CORE_ADDR read_register ();
+void write_register ();
+void supply_register ();
+void get_saved_register ();
+
 void modify_field ();
 void type_print ();
 void type_print_1 ();
+
+/* Possibilities for prettyprint parameters to routines which print
+   things.  */
+enum val_prettyprint {
+  Val_no_prettyprint = 0,
+  Val_prettyprint,
+  /* Use the default setting which the user has specified.  */
+  Val_pretty_default
+  };
+
+char *baseclass_addr ();
+void print_floating ();
+int value_print ();
+int val_print ();
+void print_variable_value ();
+char *internalvar_name ();
+void clear_value_history ();
+void clear_internalvars ();
+
+#endif /* value.h not already included.  */
This page took 0.026295 seconds and 4 git commands to generate.