aboutsummaryrefslogtreecommitdiff
path: root/gdb/values.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1997-08-05 21:58:57 +0000
committerPer Bothner <per@bothner.com>1997-08-05 21:58:57 +0000
commitf7f37388dc1d7910711f89b1c6b4f3808533ff2d (patch)
tree8f18c81b7fd22c852dd579cc2afe559caea8b7ac /gdb/values.c
parent0e25edcacc69ff157685d6653fb1304eae9b773d (diff)
downloadgdb-f7f37388dc1d7910711f89b1c6b4f3808533ff2d.zip
gdb-f7f37388dc1d7910711f89b1c6b4f3808533ff2d.tar.gz
gdb-f7f37388dc1d7910711f89b1c6b4f3808533ff2d.tar.bz2
* gdbtypes.h: Re-interpret struct field. Suppport address of static.
Add a bunch of macros. * coffread.c, dwarf2read.c, dwarfread.c, mdebugread.c, stabsread.c: Update to use new macros. * coffread.c, hpread.c, stabsread.c: Remove bugus TYPE_FIELD_VALUE. * value.h, values.c (value_static_field): New function. * cp-valprint.c, valops.c: Modify to use value_static_field.
Diffstat (limited to 'gdb/values.c')
-rw-r--r--gdb/values.c39
1 files changed, 31 insertions, 8 deletions
diff --git a/gdb/values.c b/gdb/values.c
index ff29d31..6f631ac 100644
--- a/gdb/values.c
+++ b/gdb/values.c
@@ -714,12 +714,37 @@ unpack_pointer (type, valaddr)
return unpack_long (type, valaddr);
}
+/* Get the value of the FIELDN'th field (which must be static) of TYPE. */
+
+value_ptr
+value_static_field (type, fieldno)
+ struct type *type;
+ int fieldno;
+{
+ CORE_ADDR addr;
+ asection *sect;
+ if (TYPE_FIELD_STATIC_HAS_ADDR (type, fieldno))
+ {
+ addr = TYPE_FIELD_STATIC_PHYSADDR (type, fieldno);
+ sect = NULL;
+ }
+ else
+ {
+ char *phys_name = TYPE_FIELD_STATIC_PHYSNAME (type, fieldno);
+ struct symbol *sym = lookup_symbol (phys_name, 0, VAR_NAMESPACE, 0, NULL);
+ if (sym == NULL)
+ return NULL;
+ addr = SYMBOL_VALUE_ADDRESS (sym);
+ sect = SYMBOL_BFD_SECTION (sym);
+ SET_FIELD_PHYSADDR (TYPE_FIELD (type, fieldno), addr);
+ }
+ return value_at (TYPE_FIELD_TYPE (type, fieldno), addr, sect);
+}
+
/* Given a value ARG1 (offset by OFFSET bytes)
of a struct or union type ARG_TYPE,
- extract and return the value of one of its fields.
- FIELDNO says which field.
-
- For C++, must also be able to return values from static fields */
+ extract and return the value of one of its (non-static) fields.
+ FIELDNO says which field. */
value_ptr
value_primitive_field (arg1, offset, fieldno, arg_type)
@@ -764,10 +789,8 @@ value_primitive_field (arg1, offset, fieldno, arg_type)
}
/* Given a value ARG1 of a struct or union type,
- extract and return the value of one of its fields.
- FIELDNO says which field.
-
- For C++, must also be able to return values from static fields */
+ extract and return the value of one of its (non-static) fields.
+ FIELDNO says which field. */
value_ptr
value_field (arg1, fieldno)