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, Sep 7, 2011 at 17:58, Jan Kratochvil <jan.kratochvil@redhat.com> wrote:
> 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"
>

Thanks for your help Jan.

I make a new patch according to it.  And I add more
test_printf_with_internalvar in the end of test because I think it can
test this issue after the inferior exec.
>
> 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?).

I didn't got this issue.  Could you post more info about this issue?

>
>
> Thanks,
> Jan
>

Best,
Hui

2011-09-07  Hui Zhu  <teawater@gmail.com>

	* gdb.base/printcmds.exp: Add test for printing internal var
	values with printf.

Attachment: test-v-string.txt
Description: Text document


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