aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
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/testsuite
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/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog8
-rw-r--r--gdb/testsuite/gdb.ada/char_enum.exp6
-rw-r--r--gdb/testsuite/gdb.ada/char_enum/foo.adb6
-rw-r--r--gdb/testsuite/gdb.ada/char_enum/pck.ads2
4 files changed, 18 insertions, 4 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 640d392..def8a31 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+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 '+'.
+
2019-08-15 Christian Biesinger <cbiesinger@google.com>
* gdb.python/python.exp: Expect a leading underscore on
diff --git a/gdb/testsuite/gdb.ada/char_enum.exp b/gdb/testsuite/gdb.ada/char_enum.exp
index c37d696..1c814aa 100644
--- a/gdb/testsuite/gdb.ada/char_enum.exp
+++ b/gdb/testsuite/gdb.ada/char_enum.exp
@@ -26,5 +26,11 @@ clean_restart ${testfile}
set bp_location [gdb_get_line_number "STOP" ${testdir}/foo.adb]
runto "foo.adb:$bp_location"
+gdb_test "ptype Char_Enum_Type" "type = \\('A', 'B', 'C', '_', '0'\\)"
gdb_test "print Char_Enum_Type'('B')" "= 1 'B'"
+gdb_test "print Char_Enum_Type'('_')" "= 3 '_'"
+gdb_test "print Char_Enum_Type'('0')" "= 4 '0'"
+gdb_test "ptype pck.Global_Enum_Type" "type = \\('x', 'Y', '\\+'\\)"
+gdb_test "print pck.Global_Enum_Type'('x')" "= 0 'x'"
gdb_test "print pck.Global_Enum_Type'('Y')" "= 1 'Y'"
+gdb_test "print pck.Global_Enum_Type'('+')" "= 2 '\\+'"
diff --git a/gdb/testsuite/gdb.ada/char_enum/foo.adb b/gdb/testsuite/gdb.ada/char_enum/foo.adb
index cf7fb7d..6ae1ef6 100644
--- a/gdb/testsuite/gdb.ada/char_enum/foo.adb
+++ b/gdb/testsuite/gdb.ada/char_enum/foo.adb
@@ -16,9 +16,9 @@
with Pck; use Pck;
procedure Foo is
- type Char_Enum_Type is ('A', 'B', 'C', 'D', 'E');
- Char : Char_Enum_Type := 'D';
- Gchar : Global_Enum_Type := 'Z';
+ type Char_Enum_Type is ('A', 'B', 'C', '_', '0');
+ Char : Char_Enum_Type := '_';
+ Gchar : Global_Enum_Type := '+';
begin
Do_Nothing (Char'Address); -- STOP
end Foo;
diff --git a/gdb/testsuite/gdb.ada/char_enum/pck.ads b/gdb/testsuite/gdb.ada/char_enum/pck.ads
index f952e1c..d3e7423 100644
--- a/gdb/testsuite/gdb.ada/char_enum/pck.ads
+++ b/gdb/testsuite/gdb.ada/char_enum/pck.ads
@@ -16,7 +16,7 @@
with System;
package Pck is
- type Global_Enum_Type is ('X', 'Y', 'Z');
+ type Global_Enum_Type is ('x', 'Y', '+');
procedure Do_Nothing (A : System.Address);
end Pck;