Add forgotten ChangeLog snippet for last elf64-x86-64.c patch.
[deliverable/binutils-gdb.git] / gdb / values.c
index c943f28fa462f1fcf6501be0869788103e02a528..42395c886e2b4cf38b68f62468a87ed9a6308edd 100644 (file)
@@ -1,7 +1,8 @@
 /* Low level packing and unpacking of values for GDB, the GNU Debugger.
+
    Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
-   1995, 1996, 1997, 1998, 1999, 2000, 2002.
-   Free Software Foundation, Inc.
+   1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003 Free Software
+   Foundation, Inc.
 
    This file is part of GDB.
 
@@ -35,6 +36,7 @@
 #include "doublest.h"
 #include "gdb_assert.h"
 #include "regcache.h"
+#include "block.h"
 
 /* Prototypes for exported functions. */
 
@@ -88,7 +90,7 @@ allocate_value (struct type *type)
   VALUE_ENCLOSING_TYPE (val) = type;
   VALUE_LVAL (val) = not_lval;
   VALUE_ADDRESS (val) = 0;
-  VALUE_FRAME (val) = 0;
+  VALUE_FRAME_ID (val) = null_frame_id;
   VALUE_OFFSET (val) = 0;
   VALUE_BITPOS (val) = 0;
   VALUE_BITSIZE (val) = 0;
@@ -220,7 +222,7 @@ value_copy (struct value *arg)
   VALUE_OFFSET (val) = VALUE_OFFSET (arg);
   VALUE_BITPOS (val) = VALUE_BITPOS (arg);
   VALUE_BITSIZE (val) = VALUE_BITSIZE (arg);
-  VALUE_FRAME (val) = VALUE_FRAME (arg);
+  VALUE_FRAME_ID (val) = VALUE_FRAME_ID (arg);
   VALUE_REGNO (val) = VALUE_REGNO (arg);
   VALUE_LAZY (val) = VALUE_LAZY (arg);
   VALUE_OPTIMIZED_OUT (val) = VALUE_OPTIMIZED_OUT (arg);
@@ -405,7 +407,7 @@ lookup_internalvar (char *name)
   register struct internalvar *var;
 
   for (var = internalvars; var; var = var->next)
-    if (STREQ (var->name, name))
+    if (strcmp (var->name, name) == 0)
       return var;
 
   var = (struct internalvar *) xmalloc (sizeof (struct internalvar));
@@ -422,11 +424,6 @@ value_of_internalvar (struct internalvar *var)
 {
   struct value *val;
 
-#ifdef IS_TRAPPED_INTERNALVAR
-  if (IS_TRAPPED_INTERNALVAR (var->name))
-    return VALUE_OF_TRAPPED_INTERNALVAR (var);
-#endif
-
   val = value_copy (var->value);
   if (VALUE_LAZY (val))
     value_fetch_lazy (val);
@@ -441,11 +438,6 @@ set_internalvar_component (struct internalvar *var, int offset, int bitpos,
 {
   register char *addr = VALUE_CONTENTS (var->value) + offset;
 
-#ifdef IS_TRAPPED_INTERNALVAR
-  if (IS_TRAPPED_INTERNALVAR (var->name))
-    SET_TRAPPED_INTERNALVAR (var, newval, bitpos, bitsize, offset);
-#endif
-
   if (bitsize)
     modify_field (addr, value_as_long (newval),
                  bitpos, bitsize);
@@ -458,11 +450,6 @@ set_internalvar (struct internalvar *var, struct value *val)
 {
   struct value *newval;
 
-#ifdef IS_TRAPPED_INTERNALVAR
-  if (IS_TRAPPED_INTERNALVAR (var->name))
-    SET_TRAPPED_INTERNALVAR (var, val, 0, 0, 0);
-#endif
-
   newval = value_copy (val);
   newval->modifiable = 1;
 
@@ -516,10 +503,6 @@ show_convenience (char *ignore, int from_tty)
 
   for (var = internalvars; var; var = var->next)
     {
-#ifdef IS_TRAPPED_INTERNALVAR
-      if (IS_TRAPPED_INTERNALVAR (var->name))
-       continue;
-#endif
       if (!varseen)
        {
          varseen = 1;
@@ -679,7 +662,7 @@ value_as_address (struct value *val)
    to an INT (or some size).  After all, it is only an offset.  */
 
 LONGEST
-unpack_long (struct type *type, char *valaddr)
+unpack_long (struct type *type, const char *valaddr)
 {
   register enum type_code code = TYPE_CODE (type);
   register int len = TYPE_LENGTH (type);
@@ -728,7 +711,7 @@ unpack_long (struct type *type, char *valaddr)
    format, result is in host format.  */
 
 DOUBLEST
-unpack_double (struct type *type, char *valaddr, int *invp)
+unpack_double (struct type *type, const char *valaddr, int *invp)
 {
   enum type_code code;
   int len;
@@ -785,7 +768,7 @@ unpack_double (struct type *type, char *valaddr, int *invp)
    to an INT (or some size).  After all, it is only an offset.  */
 
 CORE_ADDR
-unpack_pointer (struct type *type, char *valaddr)
+unpack_pointer (struct type *type, const char *valaddr)
 {
   /* Assume a CORE_ADDR can fit in a LONGEST (for now).  Not sure
      whether we want this to be true eventually.  */
@@ -811,7 +794,7 @@ value_static_field (struct type *type, int fieldno)
   else
     {
       char *phys_name = TYPE_FIELD_STATIC_PHYSNAME (type, fieldno);
-      struct symbol *sym = lookup_symbol (phys_name, 0, VAR_NAMESPACE, 0, NULL);
+      struct symbol *sym = lookup_symbol (phys_name, 0, VAR_DOMAIN, 0, NULL);
       if (sym == NULL)
        {
          /* With some compilers, e.g. HP aCC, static data members are reported
@@ -862,7 +845,9 @@ value_change_enclosing_type (struct value *val, struct type *new_encl_type)
       struct value *prev;
       
       new_val = (struct value *) xrealloc (val, sizeof (struct value) + TYPE_LENGTH (new_encl_type));
-      
+
+      VALUE_ENCLOSING_TYPE (new_val) = new_encl_type;
       /* We have to make sure this ends up in the same place in the value
         chain as the original copy, so it's clean-up behavior is the same. 
         If the value has been released, this is a waste of time, but there
@@ -983,7 +968,7 @@ value_fn_field (struct value **arg1p, struct fn_field *f, int j, struct type *ty
   struct symbol *sym;
   struct minimal_symbol *msym;
 
-  sym = lookup_symbol (physname, 0, VAR_NAMESPACE, 0, NULL);
+  sym = lookup_symbol (physname, 0, VAR_DOMAIN, 0, NULL);
   if (sym != NULL)
     {
       msym = NULL;
@@ -1036,7 +1021,7 @@ value_fn_field (struct value **arg1p, struct fn_field *f, int j, struct type *ty
    If the field is signed, we also do sign extension. */
 
 LONGEST
-unpack_field_as_long (struct type *type, char *valaddr, int fieldno)
+unpack_field_as_long (struct type *type, const char *valaddr, int fieldno)
 {
   ULONGEST val;
   ULONGEST valmask;
@@ -1255,7 +1240,9 @@ value_being_returned (struct type *valtype, struct regcache *retbuf,
 
   val = allocate_value (valtype);
   CHECK_TYPEDEF (valtype);
-  EXTRACT_RETURN_VALUE (valtype, retbuf, VALUE_CONTENTS_RAW (val));
+  /* If the function returns void, don't bother fetching the return value.  */
+  if (TYPE_CODE (valtype) != TYPE_CODE_VOID)
+    EXTRACT_RETURN_VALUE (valtype, retbuf, VALUE_CONTENTS_RAW (val));
 
   return val;
 }
This page took 0.025303 seconds and 4 git commands to generate.