From 57803a3c60f399772907ac306f6eefd9fc83fb15 Mon Sep 17 00:00:00 2001 From: Walfred Tedeschi Date: Tue, 19 Nov 2013 12:19:30 +0000 Subject: [PATCH] Fix conditions in creating a bitfield. 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 * 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 | 6 ++++++ gdb/target-descriptions.c | 2 +- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.xml/maint_print_struct.xml | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 66f20879da..d65445e1de 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2013-11-20 Walfred Tedeschi + + * 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 * arm-tdep.c (arm_get_next_pc): Remove "Infinite loop detected" diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index 44ad40122f..1410c02e12 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -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", diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 8314e045e9..68be4b3add 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-11-20 Walfred Tedeschi + + * gdb.xml/maint_print_struct.xml (bitfield): Added bitfield having + start and end equal 0. + 2013-11-19 Yao Qi * lib/mi-support.exp (mi_child_regexp): Remove 'whatever'. diff --git a/gdb/testsuite/gdb.xml/maint_print_struct.xml b/gdb/testsuite/gdb.xml/maint_print_struct.xml index 5ef0683106..deac30060a 100644 --- a/gdb/testsuite/gdb.xml/maint_print_struct.xml +++ b/gdb/testsuite/gdb.xml/maint_print_struct.xml @@ -15,6 +15,7 @@ + -- 2.34.1