[PATCH] printcmd.c (ui_printf): make internalvar string can be printf and eval when inferior cannot alloc memory
Jan Kratochvil
jan.kratochvil@redhat.com
Wed Sep 7 10:02:00 GMT 2011
On Wed, 07 Sep 2011 04:55:32 +0200, Hui Zhu wrote:
> +#Test printing internal var values with printf
> +proc test_printf_with_internalvar {} {
> + gdb_test "set \$a={\'a\',\'b\'}" ""
Escaping of ' is redundant.
> + gdb_test "printf \"%s\\n\", \$a" "ab"
I would find easier { and } instead of " and " to prevent so many backslashes
but opinions differ on it, FYI:
gdb_test_no_output {set $a={'a','b'}}
gdb_test {printf "%s\n", $a} "ab"
Still this testcase FAILs for me:
printf "%s\n", $a^M
abX^M
(gdb) FAIL: gdb.base/printcmds.exp: printf "%s\n", $a
Where X is some binary unprintable garbage character, not sure which way you
plan to fix it (maybe some `error' call if there is no zero-terminator?).
Thanks,
Jan
More information about the Gdb-patches
mailing list