aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-valprint.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2011-01-14 19:32:56 +0000
committerJoel Brobecker <brobecker@gnat.com>2011-01-14 19:32:56 +0000
commit447b483c37a0e0a04fd88756f1f731e6a28217cd (patch)
treeffb081bcbe67a0c16e5144ee36873c4896eeae6f /gdb/ada-valprint.c
parent7b64a93b0333a9520ca23d3dcbaa5b6b5eb3d6f0 (diff)
downloadgdb-447b483c37a0e0a04fd88756f1f731e6a28217cd.zip
gdb-447b483c37a0e0a04fd88756f1f731e6a28217cd.tar.gz
gdb-447b483c37a0e0a04fd88756f1f731e6a28217cd.tar.bz2
Fix printing of Wide_Character & Wide_Wide_Character entities.
Wide_Characters and Wide_Wide_Characters are incorrectly printed. Consider for instance: Medium : Wide_Character := Wide_Character'Val(16#dead#); Trying to print the value of this variable yields: (gdb) p medium $1 = 57005 '["ad"]' The integer value is correct (57005 = 0xdead), but the character representation is not, it should be: $1 = 57005 '["dead"]' Same for Wide_Wide_Characters. There were two issues: (a) The first issue was in ada-valprint, where we were assuming that character types were 1 byte long; (b) The second problem was in c-valprint, where we were down-casting the integer value of the character to type `unsigned char', causing use to lose all but the lowest byte. gdb/ChangeLog: * ada-valprint. (ada_printchar): Use the correct type length in call to ada_emit_char. * c-valprint.c (c_val_print): Remove cast in call to LA_PRINT_CHAR.
Diffstat (limited to 'gdb/ada-valprint.c')
-rw-r--r--gdb/ada-valprint.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index 630ceb5..ee37617 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -368,7 +368,7 @@ void
ada_printchar (int c, struct type *type, struct ui_file *stream)
{
fputs_filtered ("'", stream);
- ada_emit_char (c, type, stream, '\'', 1);
+ ada_emit_char (c, type, stream, '\'', TYPE_LENGTH (type));
fputs_filtered ("'", stream);
}