diff options
author | Peter Schauer <Peter.Schauer@mytum.de> | 1997-08-09 08:51:41 +0000 |
---|---|---|
committer | Peter Schauer <Peter.Schauer@mytum.de> | 1997-08-09 08:51:41 +0000 |
commit | 93e7a07fd7570202058c8d069059f42934370db4 (patch) | |
tree | 53fba10d7db0cbc8cee3e385ee021fabd466cc5f /gdb | |
parent | 0485d3df519ed4113c8829f67898c474efc5bb78 (diff) | |
download | gdb-93e7a07fd7570202058c8d069059f42934370db4.zip gdb-93e7a07fd7570202058c8d069059f42934370db4.tar.gz gdb-93e7a07fd7570202058c8d069059f42934370db4.tar.bz2 |
* values.c (value_primitive_field): Account for offset when
extracting the value of a bitfield.
From Paul Hilfinger <hilfingr@CS.Berkeley.EDU>.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/values.c | 17 |
2 files changed, 16 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bf42689..c6eeebf 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +Sat Aug 9 01:50:14 1997 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * values.c (value_primitive_field): Account for offset when + extracting the value of a bitfield. + From Paul Hilfinger <hilfingr@CS.Berkeley.EDU>. + Fri Aug 8 21:35:44 1997 Mark Alexander <marka@cygnus.com> start-sanitize-tic80 diff --git a/gdb/values.c b/gdb/values.c index 6f631ac..0ffd5a6 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -1,5 +1,5 @@ /* Low level packing and unpacking of values for GDB, the GNU Debugger. - Copyright 1986, 1987, 1989, 1991, 1993, 1994, 1995, 1996 + Copyright 1986, 1987, 1989, 1991, 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of GDB. @@ -761,13 +761,13 @@ value_primitive_field (arg1, offset, fieldno, arg_type) /* Handle packed fields */ - offset += TYPE_FIELD_BITPOS (arg_type, fieldno) / 8; if (TYPE_FIELD_BITSIZE (arg_type, fieldno)) { v = value_from_longest (type, - unpack_field_as_long (arg_type, - VALUE_CONTENTS (arg1), - fieldno)); + unpack_field_as_long (arg_type, + VALUE_CONTENTS (arg1) + + offset, + fieldno)); VALUE_BITPOS (v) = TYPE_FIELD_BITPOS (arg_type, fieldno) % 8; VALUE_BITSIZE (v) = TYPE_FIELD_BITSIZE (arg_type, fieldno); } @@ -777,14 +777,17 @@ value_primitive_field (arg1, offset, fieldno, arg_type) if (VALUE_LAZY (arg1)) VALUE_LAZY (v) = 1; else - memcpy (VALUE_CONTENTS_RAW (v), VALUE_CONTENTS_RAW (arg1) + offset, + memcpy (VALUE_CONTENTS_RAW (v), + VALUE_CONTENTS_RAW (arg1) + offset + + TYPE_FIELD_BITPOS (arg_type, fieldno) / 8, TYPE_LENGTH (type)); } VALUE_LVAL (v) = VALUE_LVAL (arg1); if (VALUE_LVAL (arg1) == lval_internalvar) VALUE_LVAL (v) = lval_internalvar_component; VALUE_ADDRESS (v) = VALUE_ADDRESS (arg1); - VALUE_OFFSET (v) = offset + VALUE_OFFSET (arg1); + VALUE_OFFSET (v) = VALUE_OFFSET (arg1) + offset + + TYPE_FIELD_BITPOS (arg_type, fieldno) / 8; return v; } |