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

Jan Kratochvil
2011-09-09T07:59:08Z

On Fri, 09 Sep 2011 09:27:09 +0200, Hui Zhu wrote:
> > Â  Â gdb_test_no_output {set $a={'a','b'}}

(I forgot to state the original gdb_test expect string "" matches any output.)

> > 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?

The primary problem is the regression with valgrind, as shown in:
http://sourceware.org/ml/gdb-patches/2011-09/msg00084.html
http://sourceware.org/gdb/wiki/TestingGDB#Running_GDB_under_Valgrind_in_the_testsuite

The valgrind regression is present even with live inferior (but GDB must not
valgrind-complain even on commands which were refused with error before).

Moreover when I link GDB with -lmcheck (which I always do) I get the testcase
FAIL as shown above but that is exactly the same GDB code patch problem as the
valgrind-shown case.

I did not try to but I think with proper size of the $a array GDB will crash.

very minor issue: Now with your recent change it will with -lmcheck:
FAIL: gdb.base/printcmds.exp: printf "%s\n", $a
FAIL: gdb.base/printcmds.exp: printf "%s\n", $a
- the testcase names should be unique.

Thanks,
Jan