From d9e983823a937b588efcdca81417eb39ae0c8797 Mon Sep 17 00:00:00 2001 From: Sergio Durigan Junior Date: Mon, 11 Feb 2013 18:05:35 +0000 Subject: gdb/: 2013-02-11 Sergio Durigan Junior * valops.c (value_assign): Handling bitfield offset in `lval_internalvar_component' case. gdb/testsuite/: 2013-02-11 Sergio Durigan Junior * gdb.base/bitfields.c (struct internalvartest): New declaration. * gdb.base/bitfields.exp (bitfield_internalvar): New function. --- gdb/testsuite/gdb.base/bitfields.exp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'gdb/testsuite/gdb.base/bitfields.exp') 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 -- cgit v1.1