aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2019-08-01 11:41:32 -0600
committerTom Tromey <tromey@adacore.com>2019-08-15 13:42:31 -0600
commit272560b577894c388a3d0d3fda8294683714f582 (patch)
tree3d1482fc1b7b8d3585b59a06bd5120c198c13cde /gdb/ada-lang.c
parent08235187bcdd66599884f33b046cf8abcf949727 (diff)
downloadgdb-272560b577894c388a3d0d3fda8294683714f582.zip
gdb-272560b577894c388a3d0d3fda8294683714f582.tar.gz
gdb-272560b577894c388a3d0d3fda8294683714f582.tar.bz2
Fix bug with character enumeration literal
gnat encodes character enumeration literals using a few different schemes. The gnat compiler documented the "QU" and "QW" encodings, but failed to document that a simpler encoding was used for certain characters. This patch updates gdb to handle this simple Q encoding. Note that wide character literals are still not handled. gdb/ChangeLog 2019-08-15 Tom Tromey <tromey@adacore.com> * ada-exp.y (convert_char_literal): Handle "Q%c" encoding. * ada-lang.c (ada_enum_name): Likewise. gdb/testsuite/ChangeLog 2019-08-15 Tom Tromey <tromey@adacore.com> * gdb.ada/char_enum.exp: Add regression tests. * gdb.ada/char_enum/foo.adb (Char_Enum_Type): Use '_' and '0'. (Char, Gchar): Update. * gdb.ada/char_enum/pck.ads (Global_Enum_Type): Use '+'.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r--gdb/ada-lang.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 21a8e92..609f2d4 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -9439,6 +9439,14 @@ ada_enum_name (const char *name)
if (sscanf (name + 2, "%x", &v) != 1)
return name;
}
+ else if (((name[1] >= '0' && name[1] <= '9')
+ || (name[1] >= 'a' && name[1] <= 'z'))
+ && name[2] == '\0')
+ {
+ GROW_VECT (result, result_len, 4);
+ xsnprintf (result, result_len, "'%c'", name[1]);
+ return result;
+ }
else
return name;