This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] printcmd.c (ui_printf): make internalvar string can be printf and eval when inferior cannot alloc memory


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]