diff options
author | Sergio Durigan Junior <sergiodj@redhat.com> | 2013-02-11 18:05:35 +0000 |
---|---|---|
committer | Sergio Durigan Junior <sergiodj@redhat.com> | 2013-02-11 18:05:35 +0000 |
commit | d9e983823a937b588efcdca81417eb39ae0c8797 (patch) | |
tree | b3d58add7a5b09e41d55fe270431585b7107629f /gdb/valops.c | |
parent | ee227692d767127ac01b420d35c064d4ac03a6a2 (diff) | |
download | gdb-d9e983823a937b588efcdca81417eb39ae0c8797.zip gdb-d9e983823a937b588efcdca81417eb39ae0c8797.tar.gz gdb-d9e983823a937b588efcdca81417eb39ae0c8797.tar.bz2 |
gdb/:
2013-02-11 Sergio Durigan Junior <sergiodj@redhat.com>
* valops.c (value_assign): Handling bitfield offset in
`lval_internalvar_component' case.
gdb/testsuite/:
2013-02-11 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.base/bitfields.c (struct internalvartest): New declaration.
* gdb.base/bitfields.exp (bitfield_internalvar): New function.
Diffstat (limited to 'gdb/valops.c')
-rw-r--r-- | gdb/valops.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/gdb/valops.c b/gdb/valops.c index 2132f3e..93c09d8 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1233,11 +1233,27 @@ value_assign (struct value *toval, struct value *fromval) VALUE_INTERNALVAR (toval)); case lval_internalvar_component: - set_internalvar_component (VALUE_INTERNALVAR (toval), - value_offset (toval), - value_bitpos (toval), - value_bitsize (toval), - fromval); + { + int offset = value_offset (toval); + + /* Are we dealing with a bitfield? + + It is important to mention that `value_parent (toval)' is + non-NULL iff `value_bitsize (toval)' is non-zero. */ + if (value_bitsize (toval)) + { + /* VALUE_INTERNALVAR below refers to the parent value, while + the offset is relative to this parent value. */ + gdb_assert (value_parent (value_parent (toval)) == NULL); + offset += value_offset (value_parent (toval)); + } + + set_internalvar_component (VALUE_INTERNALVAR (toval), + offset, + value_bitpos (toval), + value_bitsize (toval), + fromval); + } break; case lval_memory: |