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/testsuite/gdb.base/bitfields.exp | |
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/testsuite/gdb.base/bitfields.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/bitfields.exp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/bitfields.exp b/gdb/testsuite/gdb.base/bitfields.exp index 9095736..82f7b10 100644 --- a/gdb/testsuite/gdb.base/bitfields.exp +++ b/gdb/testsuite/gdb.base/bitfields.exp @@ -245,6 +245,31 @@ proc bitfield_at_offset {} { gdb_test "print container.two.u3" ".* = 3" } +proc bitfield_internalvar {} { + global gdb_prompt + + # First, we create an internal var holding an instance of + # the struct (zeroed out). + gdb_test "set \$myvar = (struct internalvartest) \{0\}" "" \ + "set internal var" + + # Now, we set the proper bits. + gdb_test_no_output "set \$myvar.a = 0" + gdb_test_no_output "set \$myvar.inner.b = 1" + gdb_test_no_output "set \$myvar.inner.deep.c = 0" + gdb_test_no_output "set \$myvar.inner.deep.d = -1" + gdb_test_no_output "set \$myvar.inner.e = 1" + gdb_test_no_output "set \$myvar.f = 1" + + # Here comes the true testing. + gdb_test "print \$myvar.a" "\\$\[0-9\]\+ = 0" + gdb_test "print \$myvar.inner.b" "\\$\[0-9\]\+ = 1" + gdb_test "print \$myvar.inner.deep.c" "\\$\[0-9\]\+ = 0" + gdb_test "print \$myvar.inner.deep.d" "\\$\[0-9\]\+ = -1" + gdb_test "print \$myvar.inner.e" "\\$\[0-9\]\+ = -1" + gdb_test "print \$myvar.f" "\\$\[0-9\]\+ = -1" +} + gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} @@ -256,3 +281,4 @@ bitfield_containment bitfield_unsignedness bitfield_signedness bitfield_at_offset +bitfield_internalvar |