aboutsummaryrefslogtreecommitdiff
path: root/gdb/target-descriptions.c
diff options
context:
space:
mode:
authorSergio Durigan Junior <sergiodj@redhat.com>2012-04-25 18:36:05 +0000
committerSergio Durigan Junior <sergiodj@redhat.com>2012-04-25 18:36:05 +0000
commit4e2f8df673369ac03d523aa2ff1ecd11fbf9cb22 (patch)
tree396eea8c306314cd7af6745f6d2ccbfc1a801949 /gdb/target-descriptions.c
parent2e30cb575a1d2b1eb8f776356ed59b0722a943d1 (diff)
downloadgdb-4e2f8df673369ac03d523aa2ff1ecd11fbf9cb22.zip
gdb-4e2f8df673369ac03d523aa2ff1ecd11fbf9cb22.tar.gz
gdb-4e2f8df673369ac03d523aa2ff1ecd11fbf9cb22.tar.bz2
2012-04-25 Sergio Durigan Junior <sergiodj@redhat.com>
* features/arm-with-iwmmxt.c: Regenerate. * features/arm-with-m-fpa-layout.c: Likewise. * features/arm-with-m.c: Likewise. * features/arm-with-neon.c: Likewise. * features/arm-with-vfpv2.c: Likewise. * features/arm-with-vfpv3.c: Likewise. * features/mips-dsp-linux.c: Likewise. * features/mips-linux.c: Likewise. * features/mips64-dsp-linux.c: Likewise. * features/mips64-linux.c: Likewise. * features/s390-linux32.c: Likewise. * features/s390-linux32v1.c: Likewise. * features/s390-linux32v2.c: Likewise. * features/s390-linux64.c: Likewise. * features/s390-linux64v1.c: Likewise. * features/s390-linux64v2.c: Likewise. * features/s390x-linux64.c: Likewise. * features/s390x-linux64v1.c: Likewise. * features/s390x-linux64v2.c: Likewise. * features/tic6x-c62x-linux.c: Likewise. * features/tic6x-c62x.c: Likewise. * features/tic6x-c64x-linux.c: Likewise. * features/tic6x-c64x.c: Likewise. * features/tic6x-c64xp-linux.c: Likewise. * features/tic6x-c64xp.c: Likewise. * target-descriptions.c: Only generate `field_type' and `type' variables when needed.
Diffstat (limited to 'gdb/target-descriptions.c')
-rw-r--r--gdb/target-descriptions.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 0b12e3e..16aaa64 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -1550,6 +1550,7 @@ maint_print_c_tdesc_cmd (char *args, int from_tty)
struct tdesc_type_field *f;
struct tdesc_type_flag *flag;
int ix, ix2, ix3;
+ int printed_field_type = 0;
/* Use the global target-supplied description, not the current
architecture's. This lets a GDB for one architecture generate C
@@ -1588,7 +1589,39 @@ maint_print_c_tdesc_cmd (char *args, int from_tty)
printf_unfiltered
(" struct target_desc *result = allocate_target_description ();\n");
printf_unfiltered (" struct tdesc_feature *feature;\n");
- printf_unfiltered (" struct tdesc_type *field_type, *type;\n");
+
+ /* Now we do some "filtering" in order to know which variables to
+ declare. This is needed because otherwise we would declare unused
+ variables `field_type' and `type'. */
+ for (ix = 0;
+ VEC_iterate (tdesc_feature_p, tdesc->features, ix, feature);
+ ix++)
+ {
+ int printed_desc_type = 0;
+
+ for (ix2 = 0;
+ VEC_iterate (tdesc_type_p, feature->types, ix2, type);
+ ix2++)
+ {
+ if (!printed_field_type)
+ {
+ printf_unfiltered (" struct tdesc_type *field_type;\n");
+ printed_field_type = 1;
+ }
+
+ if (type->kind == TDESC_TYPE_UNION
+ && VEC_length (tdesc_type_field, type->u.u.fields) > 0)
+ {
+ printf_unfiltered (" struct tdesc_type *type;\n");
+ printed_desc_type = 1;
+ break;
+ }
+ }
+
+ if (printed_desc_type)
+ break;
+ }
+
printf_unfiltered ("\n");
if (tdesc_architecture (tdesc) != NULL)