Fix conditions in creating a bitfield.
authorWalfred Tedeschi <walfred.tedeschi@intel.com>
Tue, 19 Nov 2013 12:19:30 +0000 (12:19 +0000)
committerWalfred Tedeschi <walfred.tedeschi@intel.com>
Wed, 20 Nov 2013 13:42:49 +0000 (14:42 +0100)
Bitfields are represented by intervals [start, begin]. It means that for an
interval comprised by only one  bit start and end will be equal.
The present condition does not always hold. On the other hand in target-description.c
(tdesc_gdb_type) bitfield is created when "f->type" is null. The routine
maint_print_maint_print_c_tdesc_cmd is modified to follow the same strategy.

2013-11-20  Walfred Tedeschi  <walfred.tedeschi@intel.com>

* target-descriptions.c (maint_print_maint_print_c_tdesc_cmd):
Modified logic of creating a bitfield to be in sync with
tdesc_gdb_type.

testsuite/
* gdb.xml/maint_print_struct.xml (bitfield): Added bitfield having
start and end equal 0.

Change-Id: I8c62db049995f0c0c30606d9696b86afe237cbb9

gdb/ChangeLog
gdb/target-descriptions.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.xml/maint_print_struct.xml

index 66f20879da7ae1518cd04fd1318e3086ac4f0152..d65445e1def122fcc0ae7086d83abb9114eb189f 100644 (file)
@@ -1,3 +1,9 @@
+2013-11-20  Walfred Tedeschi  <walfred.tedeschi@intel.com>
+
+       * target-descriptions.c (maint_print_maint_print_c_tdesc_cmd):
+       Modified logic of creating a bitfield to be in sync with
+       tdesc_gdb_type.
+
 2013-11-20  Will Newton  <will.newton@linaro.org>
 
        * arm-tdep.c (arm_get_next_pc): Remove "Infinite loop detected"
index 44ad40122f606b041d1e8e86120dbff40a0554e4..1410c02e12d5d0a88fdd038bf0481df15f5aab46 100644 (file)
@@ -1762,7 +1762,7 @@ feature = tdesc_create_feature (result, \"%s\");\n",
                  /* Going first for implicitly sized types, else part handles
                     bitfields.  As reported on xml-tdesc.c implicitly sized types
                     cannot contain a bitfield.  */
-                 if (f->start == 0 && f->end == 0)
+                 if (f->type != NULL)
                    {
                      printf_unfiltered
                        ("  field_type = tdesc_named_type (feature, \"%s\");\n",
index 8314e045e9c2801b6ba1464a5250d9f07e1cf2c9..68be4b3add9742f44b4af80b3d5b95d68595164a 100644 (file)
@@ -1,3 +1,8 @@
+2013-11-20  Walfred Tedeschi  <walfred.tedeschi@intel.com>
+
+       * gdb.xml/maint_print_struct.xml (bitfield): Added bitfield having
+       start and end equal 0.
+
 2013-11-19  Yao Qi  <yao@codesourcery.com>
 
        * lib/mi-support.exp (mi_child_regexp): Remove 'whatever'.
index 5ef0683106223b56d3239d7cdd7131af28a7c5df..deac30060ab05f5783d40b92e51bdff24a5f689e 100644 (file)
@@ -15,6 +15,7 @@
   </struct>
 
   <struct id="bitfield" size="8">
+    <field name="field0" start="0" end="0"/>
     <field name="field1" start="24" end="63"/>
     <field name="field2" start="16" end="24"/>
   </struct>