aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/bitfields.exp
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2009-08-28 18:50:49 +0000
committerDaniel Jacobowitz <drow@false.org>2009-08-28 18:50:49 +0000
commit4a76eae5946577891a09412077a5bbd3ea532885 (patch)
tree072a437dc31f2c364206b6e61bb53ae2a3d844e0 /gdb/testsuite/gdb.base/bitfields.exp
parentd4b96c9a787ed13b0b9367b5fedb96a4746a5c9d (diff)
downloadgdb-4a76eae5946577891a09412077a5bbd3ea532885.zip
gdb-4a76eae5946577891a09412077a5bbd3ea532885.tar.gz
gdb-4a76eae5946577891a09412077a5bbd3ea532885.tar.bz2
PR gdb/10565
* value.c (value_primitive_field): Do not save value_offset for bitfields. (unpack_bits_as_long): Do not read an entire ULONGEST. testsuite/ PR gdb/10565 * gdb.base/bitfields.c (struct container, container): New. (main): Initialize it and call break5. * gdb.base/bitfields.exp (bitfield_at_offset): New test.
Diffstat (limited to 'gdb/testsuite/gdb.base/bitfields.exp')
-rw-r--r--gdb/testsuite/gdb.base/bitfields.exp22
1 files changed, 22 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/bitfields.exp b/gdb/testsuite/gdb.base/bitfields.exp
index 31e8b01..659785e 100644
--- a/gdb/testsuite/gdb.base/bitfields.exp
+++ b/gdb/testsuite/gdb.base/bitfields.exp
@@ -233,6 +233,26 @@ proc bitfield_signedness {} {
gdb_stop_suppressing_tests;
}
+# Test bitfields at non-zero offsets in a struct.
+
+proc bitfield_at_offset {} {
+ global decimal
+ global hex
+ global gdb_prompt
+ global srcfile
+
+ gdb_breakpoint break5
+ if [gdb_test "cont" "Break.*break5 \\(\\) at .*$srcfile:$decimal.*" "continuing to break5"] {
+ return
+ }
+
+ set one ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 5, s9 = 0, u9 = 0, sc = 0.*"
+ set two ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 3, s9 = 0, u9 = 0, sc = 0.*"
+ gdb_test "print container" "$one$two" "distinct bitfields in container"
+ gdb_test "print container.one.u3" ".* = 5"
+ gdb_test "print container.two.u3" ".* = 3"
+}
+
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
@@ -264,3 +284,5 @@ if [istarget "mips-idt-*"] then {
gdb_load ${binfile}
}
bitfield_signedness
+
+bitfield_at_offset