handle character-based enumeration typedefs
authorJoel Brobecker <brobecker@gnat.com>
Fri, 1 Jul 2011 18:25:17 +0000 (18:25 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Fri, 1 Jul 2011 18:25:17 +0000 (18:25 +0000)
commit18920c42269018b87630cab5d90ed7b323dbfd55
tree2ec74f0260fb2958393f00d98094e9b1466f3dc6
parentc90092fe9e8d9932f59c5927c67d83c231e47407
handle character-based enumeration typedefs

Consider the following type:

   type Char_Enum_Type is ('A', 'B', 'C', 'D');

If the compiler generates a Char_Enum_Type typedef in the debugging
information, the debugger fails in the following case:

   (gdb) p Char_Enum_Type'('B')
   $1 = 66

For our type, the underlying value of 'B' is actually 1, not 66
(ASCII 'B').  We are failing this case because we were not handling
typedef to enum types before.  This patch fixes this.

gdb/ChangeLog:

        * ada-exp.y (convert_char_literal): Handle typedef types.

gdb/testsuite/ChangeLog:

        * gdb.ada/char_enum: New testcase.
gdb/ChangeLog
gdb/ada-exp.y
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/char_enum.exp [new file with mode: 0644]
gdb/testsuite/gdb.ada/char_enum/foo.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/char_enum/pck.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/char_enum/pck.ads [new file with mode: 0644]