]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Fix printing of Wide_Character & Wide_Wide_Character entities.
authorJoel Brobecker <brobecker@gnat.com>
Fri, 14 Jan 2011 20:18:21 +0000 (20:18 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Fri, 14 Jan 2011 20:18:21 +0000 (20:18 +0000)
commit384e9296f48f49db7620df6d8294131212f66339
tree707adec7519e48d936ef2ba83a9d6c4dd5da8419
parent40eb5175dc512f6ebdacf466f307beea7158134a
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.
gdb/ChangeLog
gdb/ada-valprint.c
gdb/c-valprint.c