diff options
author | John Gilmore <gnu@cygnus> | 1991-09-06 07:13:38 +0000 |
---|---|---|
committer | John Gilmore <gnu@cygnus> | 1991-09-06 07:13:38 +0000 |
commit | 96b2f51cdce670745f5d159680892945b33c7ac6 (patch) | |
tree | 56ccf3af5bce2ae50a5043ed392bf4e9f3e1cb53 /gdb | |
parent | 06b6c733aedcaeaa7b54a7152e9d5e5dfdc6266f (diff) | |
download | gdb-96b2f51cdce670745f5d159680892945b33c7ac6.zip gdb-96b2f51cdce670745f5d159680892945b33c7ac6.tar.gz gdb-96b2f51cdce670745f5d159680892945b33c7ac6.tar.bz2 |
Fix some infrastructure to be able to cope with host and target
machines with different sized basic types (ints, ptrs, etc).
(Idea from pierre@la.tce.com (Pierre Willard).)
* values.c (value_from_longest): Rename from value_from_long.
Handle pointer types as well as integers, so that targets with
different pointer sizes from the host can be accomodated.
* breakpoint.c, convex-tdep.c, eval.c, expprint.c, printcmd.c,
valarith.c, valops.c, valprint.c, value.h, values.c: Rename
uses of value_from_long to value_from_longest.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/values.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/gdb/values.c b/gdb/values.c index dd53a86..ce0bc45 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -836,7 +836,7 @@ value_primitive_field (arg1, offset, fieldno, arg_type) offset += TYPE_FIELD_BITPOS (arg_type, fieldno) / 8; if (TYPE_FIELD_BITSIZE (arg_type, fieldno)) { - v = value_from_long (type, + v = value_from_longest (type, unpack_field_as_long (arg_type, VALUE_CONTENTS (arg1), fieldno)); @@ -917,7 +917,7 @@ value_virtual_fn_field (arg1, f, j, type) should serve just fine as a function type). Then, index into the table, and convert final value to appropriate function type. */ value entry, vfn, vtbl; - value vi = value_from_long (builtin_type_int, + value vi = value_from_longest (builtin_type_int, (LONGEST) TYPE_FN_FIELD_VOFFSET (f, j)); struct type *fcontext = TYPE_FN_FIELD_FCONTEXT (f, j); struct type *context; @@ -1018,7 +1018,8 @@ value_headof (arg, btype, dtype) nelems = longest_to_int (value_as_long (value_field (entry, 2))); for (i = 1; i <= nelems; i++) { - entry = value_subscript (vtbl, value_from_long (builtin_type_int, i)); + entry = value_subscript (vtbl, value_from_longest (builtin_type_int, + (LONGEST) i)); offset = longest_to_int (value_as_long (value_field (entry, 0))); if (offset < best_offset) { @@ -1397,7 +1398,7 @@ modify_field (addr, fieldval, bitpos, bitsize) /* Convert C numbers into newly allocated values */ value -value_from_long (type, num) +value_from_longest (type, num) struct type *type; register LONGEST num; { @@ -1405,7 +1406,9 @@ value_from_long (type, num) register enum type_code code = TYPE_CODE (type); register int len = TYPE_LENGTH (type); - if (code == TYPE_CODE_INT || code == TYPE_CODE_ENUM) + /* FIXME, we assume that pointers have the same form and byte order as + integers, and that all pointers have the same form. */ + if (code == TYPE_CODE_INT || code == TYPE_CODE_ENUM || code == TYPE_CODE_PTR) { if (len == sizeof (char)) * (char *) VALUE_CONTENTS_RAW (val) = num; |