Re: [PATCH v2 2/5] Further cleanup/modernization of gdb.base/commands.exp

Simon Marchi
2016-11-09T03:02:30Z

On 2016-11-08 19:19, Pedro Alves wrote:
> - Use multi_line for matching multi-line GDB output.
>
> - Add a multi_line_input variant of multi_line to build GDB input and
> use it throughout.
>
> (The two changes above make the tests much more readable, IMO.)
>
> - Remove gdb_stop_suppressing_tests uses.
>
> - tighten a few regexps.
>
> - Replace send_gdb/gdb_expect with gdb_test_multiple and simplify,
> making pass/fail messages the same.

I agree, the test is now much more readable.

> + gdb_test \
> + [multi_line_input \
> + "while \$foo > 0" \
> + " p/x 0xfeedface" \
> + " set \$foo -= 1" \
> + "end"] \
> + [multi_line \
> + "\\\$\[0-9\]* = 0xfeedface\[^\n\]*" \
> + "\\\$\[0-9\]* = 0xfeedface\[^\n\]*" \
> + "\\\$\[0-9\]* = 0xfeedface\[^\n\]*" \
> + "\\\$\[0-9\]* = 0xfeedface\[^\n\]*" \
> + "\\\$\[0-9\]* = 0xfeedface"] \
> + "#1"

In these instance, what is the [^\n] meant to match? Is it the \r? In
that case, multi_line matches it, so I think we can get rid of them
(throughout the file).