binutils-gdb/gdb/testsuite/gdb.ada/char_enum
Tom Tromey 222a8d2558 Fix cast of character to enum type in Ada
An internal bug report points out that, when a global character enum
type is used, casting fails, like:

    (gdb) print global_char_enum'('F')
    $1 = 70

The bug here turns out to be that enumerators are qualified, so for
example the mangled name might be "pck__QU48", rather than "QU48".

This patch fixes the problem by only examining the suffix of the
enumerator.  This is ok because the type is already known, and because
the mangling scheme ensures that there won't be clashes.

Tested on x86-64 Fedora 29.

gdb/ChangeLog
2019-05-03  Tom Tromey  <tromey@adacore.com>

	* ada-exp.y (convert_char_literal): Check suffix of each
	enumerator.

gdb/testsuite/ChangeLog
2019-05-03  Tom Tromey  <tromey@adacore.com>

	* gdb.ada/char_enum/pck.ads (Global_Enum_Type): New type.
	* gdb.ada/char_enum/foo.adb: Use Global_Enum_Type.
	* gdb.ada/char_enum.exp: Add test.
2019-05-03 17:04:56 -06:00
..
foo.adb Fix cast of character to enum type in Ada 2019-05-03 17:04:56 -06:00
pck.adb Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
pck.ads Fix cast of character to enum type in Ada 2019-05-03 17:04:56 -06:00