aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2007-12-24 06:29:27 +0000
committerJoel Brobecker <brobecker@gnat.com>2007-12-24 06:29:27 +0000
commit7b9f71f2886b62bb3c0e2b5df7cbcf1ff70d77b5 (patch)
tree9d652fc333bd358f666cbf265c5521d4cca2759f /gdb/ada-lang.c
parent5209009a1b5cd9e55c6289e4f958f771548e5dc8 (diff)
downloadgdb-7b9f71f2886b62bb3c0e2b5df7cbcf1ff70d77b5.zip
gdb-7b9f71f2886b62bb3c0e2b5df7cbcf1ff70d77b5.tar.gz
gdb-7b9f71f2886b62bb3c0e2b5df7cbcf1ff70d77b5.tar.bz2
* dwarf2read.c (read_base_type): Set code to TYPE_CODE_CHAR
for char and unsigned char types of Ada compilation units. * ada-lang.c (ada_is_character_type): Always return true if the type code is TYPE_CODE_CHAR.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r--gdb/ada-lang.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index d549662..83afdd7 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -7286,15 +7286,22 @@ value_val_atr (struct type *type, struct value *arg)
int
ada_is_character_type (struct type *type)
{
- const char *name = ada_type_name (type);
- return
- name != NULL
- && (TYPE_CODE (type) == TYPE_CODE_CHAR
- || TYPE_CODE (type) == TYPE_CODE_INT
- || TYPE_CODE (type) == TYPE_CODE_RANGE)
- && (strcmp (name, "character") == 0
- || strcmp (name, "wide_character") == 0
- || strcmp (name, "unsigned char") == 0);
+ const char *name;
+
+ /* If the type code says it's a character, then assume it really is,
+ and don't check any further. */
+ if (TYPE_CODE (type) == TYPE_CODE_CHAR)
+ return 1;
+
+ /* Otherwise, assume it's a character type iff it is a discrete type
+ with a known character type name. */
+ name = ada_type_name (type);
+ return (name != NULL
+ && (TYPE_CODE (type) == TYPE_CODE_INT
+ || TYPE_CODE (type) == TYPE_CODE_RANGE)
+ && (strcmp (name, "character") == 0
+ || strcmp (name, "wide_character") == 0
+ || strcmp (name, "unsigned char") == 0));
}
/* True if TYPE appears to be an Ada string type. */