Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: gdb/target-descriptions.c

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/target.c ('k') | gdb/testsuite/.gdbinit » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/target-descriptions.c
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index cbcca765a7536f72376c52e34605dc0446854682..16aaa64026bd255d7d7dcd63b3f15daa7738330a 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -657,9 +657,9 @@ tdesc_gdb_type (struct gdbarch *gdbarch, struct tdesc_type *tdesc_type)
bitsize = f->end - f->start + 1;
total_size = tdesc_type->u.u.size * TARGET_CHAR_BIT;
if (gdbarch_bits_big_endian (gdbarch))
- FIELD_BITPOS (fld[0]) = total_size - f->start - bitsize;
+ SET_FIELD_BITPOS (fld[0], total_size - f->start - bitsize);
else
- FIELD_BITPOS (fld[0]) = f->start;
+ SET_FIELD_BITPOS (fld[0], f->start);
FIELD_BITSIZE (fld[0]) = bitsize;
}
else
@@ -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)
« no previous file with comments | « gdb/target.c ('k') | gdb/testsuite/.gdbinit » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698