aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-valprint.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-01-26 07:11:18 -0700
committerTom Tromey <tromey@adacore.com>2022-02-28 10:49:29 -0700
commitc9f66f0005000492739dd063ea2949045bf70bc6 (patch)
tree7298f37b0e63711abc336fa0695d80a67d5c9144 /gdb/ada-valprint.c
parenta7041de85a0cc43b86989eb697cef7a6cecdbdb7 (diff)
downloadgdb-c9f66f0005000492739dd063ea2949045bf70bc6.zip
gdb-c9f66f0005000492739dd063ea2949045bf70bc6.tar.gz
gdb-c9f66f0005000492739dd063ea2949045bf70bc6.tar.bz2
Handle multi-byte bracket sequences in Ada lexer
As noted in an earlier patch, the Ada lexer does not handle multi-byte bracket sequences. This patch adds support for these for character literals. gdb does not generally seem to handle the Ada wide string types, so for the time being these continue to be excluded -- but an explicit error is added to make this more clear.
Diffstat (limited to 'gdb/ada-valprint.c')
-rw-r--r--gdb/ada-valprint.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index a59c392..bf95719 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -277,7 +277,11 @@ ada_emit_char (int c, struct type *type, struct ui_file *stream,
fprintf_filtered (stream, "%c", c);
}
else
- fprintf_filtered (stream, "[\"%0*x\"]", type_len * 2, c);
+ {
+ /* Follow GNAT's lead here and only use 6 digits for
+ wide_wide_character. */
+ fprintf_filtered (stream, "[\"%0*x\"]", std::min (6, type_len * 2), c);
+ }
}
/* Character #I of STRING, given that TYPE_LEN is the size in bytes