Normalize Ada ptype to use a single "?"
Sometimes -- notably with unchecked unions -- the Ada "ptype" code will print a "?" or "??" to indicate something unknown. The choice of what was printed was somewhat arbitrary, and in one case, Ada would print an empty string rather than "?". This patch normalizes the Ada code to use "?" rather than an empty string or "??". My reasoning here is that a single question mark is enough to convey unknown-ness. gdb/ChangeLog 2019-12-10 Tom Tromey <tromey@adacore.com> * ada-typeprint.c (print_choices): Use a single "?". (print_variant_part): Print "?" if the discriminant name is not known. gdb/testsuite/ChangeLog 2019-12-10 Tom Tromey <tromey@adacore.com> * gdb.ada/unchecked_union.exp: New file. * gdb.ada/unchecked_union/pck.adb: New file. * gdb.ada/unchecked_union/pck.ads: New file. * gdb.ada/unchecked_union/unchecked_union.adb: New file. * gdb-utils.exp (string_to_regexp): Also quote "?". Change-Id: I3403040780a155ffa2c44c8e6a04ba86bc810e29
This commit is contained in:
parent
0a0a052176
commit
6c71eb7d70
8 changed files with 171 additions and 5 deletions
|
@ -526,7 +526,7 @@ print_choices (struct type *type, int field_num, struct ui_file *stream,
|
|||
}
|
||||
|
||||
Huh:
|
||||
fprintf_filtered (stream, "?? =>");
|
||||
fprintf_filtered (stream, "? =>");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -592,9 +592,12 @@ print_variant_part (struct type *type, int field_num, struct type *outer_type,
|
|||
struct ui_file *stream, int show, int level,
|
||||
const struct type_print_options *flags)
|
||||
{
|
||||
fprintf_filtered (stream, "\n%*scase %s is", level + 4, "",
|
||||
ada_variant_discrim_name
|
||||
(TYPE_FIELD_TYPE (type, field_num)));
|
||||
const char *variant
|
||||
= ada_variant_discrim_name (TYPE_FIELD_TYPE (type, field_num));
|
||||
if (*variant == '\0')
|
||||
variant = "?";
|
||||
|
||||
fprintf_filtered (stream, "\n%*scase %s is", level + 4, "", variant);
|
||||
print_variant_clauses (type, field_num, outer_type, stream, show,
|
||||
level + 4, flags);
|
||||
fprintf_filtered (stream, "\n%*send case;", level + 4, "");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue