Re: [PATCH 2/3] gdb: Replace \r\n with multi_line to make tests more readable

Andreas Schwab
2025-11-26T12:44:32Z

On Nov 26 2025, Daniel Knezevic wrote:

> gdb_test "ptype the_highest" \
> - "type = struct highest \{.*\[\r\n\] *int a;.*\[\r\n\] *struct \{.*\[\r\n\] *int b;.*\[\r\n\] *struct \{\.\.\.\} anonymous_level_2;.*\[\r\n\] *\} anonymous_level_1;.*\[\r\n\]}.*" \
> - "ptype the_highest"
> + [multi_line \
> + "type = struct highest {" \
> + " int a;" \
> + " struct {" \
> + " int b;" \
> + " struct \{\.\.\.\} anonymous_level_2;" \
> + " \} anonymous_level_1;" \

The single backslashes inside double quotes are eaten by the tcl string
parser and won't survive into the resulting regexp.

--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."