]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR gdb/10884
authorJoel Brobecker <brobecker@gnat.com>
Mon, 21 Dec 2009 13:21:43 +0000 (13:21 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Mon, 21 Dec 2009 13:21:43 +0000 (13:21 +0000)
        * gdb.mi/var-cmd.c (do_bitfield_tests): New
        (main): Call do_bitfield_tests.
        * gdb.mi/mi-var-cmd.exp: Run the 'bitfield' testcase.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.mi/mi-var-cmd.exp
gdb/testsuite/gdb.mi/var-cmd.c

index 176e683d7348738faa616e84f00f894ca8a9ba41..3dd23742acf6e3bc4f1ebbc368617fb57b16e7bd 100644 (file)
@@ -1,3 +1,11 @@
+2009-12-21  Vladimir Prus  <vladimir@codesourcery.com>
+
+       PR gdb/10884
+
+       * gdb.mi/var-cmd.c (do_bitfield_tests): New
+       (main): Call do_bitfield_tests.
+       * gdb.mi/mi-var-cmd.exp: Run the 'bitfield' testcase.
+
 2009-12-21  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        * gdb.base/foll-fork.exp (unpatch child, breakpoint at exit call):
index 6efb3332d103d49825074e945ea338815916eaea..4cb2552f7f4bfc78c60b709626866b2391b843ef 100644 (file)
@@ -577,6 +577,8 @@ proc set_frozen {varobjs flag} {
 mi_prepare_inline_tests $srcfile
 mi_run_inline_test frozen
 
+mi_run_inline_test bitfield
+
 # Since the inline test framework does not really work with
 # function calls, first to inline tests and then do the reminder
 # manually.
index 6372f64b5de2ff45fa43010414cb07a72f73251b..bbadc24ba7a08fbc80aa129fba3f45f196bbcff5 100644 (file)
@@ -468,6 +468,40 @@ void do_at_tests ()
   /*: END: floating :*/
 }
 
+/* Some header appear to define uint already, so apply some
+   uglification.  Note that without uglification, the compile
+   does not fail, rather, we don't test what we want because
+   something else calls check_typedef on 'uint' already.  */
+typedef unsigned int uint_for_mi_testing;
+
+struct Data {
+  int alloc;
+  uint_for_mi_testing sharable : 4;
+};
+
+/* Accessing a value of a bitfield whose type is a typed used to
+   result in division by zero.  See:
+
+         http://sourceware.org/bugzilla/show_bug.cgi?id=10884
+
+   This tests for this bug.  */
+
+void do_bitfield_tests ()
+{
+  /*: BEGIN: bitfield :*/
+  struct Data d = {0, 3};
+  /*:
+    mi_create_varobj V d "create varobj for Data"
+    mi_list_varobj_children "V" {
+        {"V.alloc" "alloc" "0" "int"}
+        {"V.sharable" "sharable" "0" "unsigned int"}
+    } "list children of Data"
+    mi_check_varobj_value V.sharable 3 "access bitfield"
+    :*/
+  return;
+  /*: END: bitfield :*/  
+}
+
 int
 main (int argc, char *argv [])
 {
@@ -477,6 +511,7 @@ main (int argc, char *argv [])
   do_special_tests ();
   do_frozen_tests ();
   do_at_tests ();
+  do_bitfield_tests ();
   exit (0);
 }