This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/3] Test of breakpoint output for dprintf
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: Yao Qi <yao at codesourcery dot com>, gdb-patches at sourceware dot org
- Date: Thu, 10 Jan 2013 09:43:42 +0400
- Subject: Re: [PATCH 1/3] Test of breakpoint output for dprintf
- References: <1355285581-28889-1-git-send-email-yao@codesourcery.com> <1355285581-28889-2-git-send-email-yao@codesourcery.com> <87vcb6w0v7.fsf@fleche.redhat.com>
> Yao> +gdb_test "info breakpoints" "3\[\t \]+dprintf .*
> Yao> +\[\t \]+printf \"At foo entry\\\\n\".
> Yao> +\[\t \]+continue.
> Yao> +4\[\t \]+dprintf .*
> Yao> +\[\t \]+printf \"arg=%d, g=%d\\\\n\", arg, g.
> Yao> +\[\t \]+continue." "dprintf info 1"
>
> I find this style of test pretty hard to read.
> How about using "\n" instead of a newline?
> Or writing the string some other way to make it more readable?
FWIW, I sometimes do the following when writing tests:
gdb_test "info tasks" \
[join {" +ID +TID P-ID Pri State +Name" \
" +1 .* main_task" \
" +2 .* task_list\\(1\\)" \
"\\* +3 .* task_list\\(2\\)" \
" +4 .* task_list\\(3\\)"} \
"\r\n"] \
"info tasks after hitting breakpoint"
I find that having a multi-line expected output shown as multiple
lines is easier to understand than one ginormous string...
--
Joel