This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 3/3] gdb/testsuite: Handle targets with lots of registers
On Mon, 9 Apr 2018, Andrew Burgess wrote:
> # Test for a regression where this command would internal-error if the
> -# program wasn't running.
> -gdb_test "maint print registers" "Name.*Nr.*Rel.*Offset.*Size.*Type.*"
> +# program wasn't running. If there's a lot of registers then this
> +# might overflow expect's buffers, so process the output line at a
> +# time.
> +send_gdb "maint print registers\n"
> +gdb_expect {
> + -re "^\[^\n\r\]+\[0-9\]+\[^\n\r\]+\[0-9\]+\[^\n\r\]+\[0-9\]+\[^\n\r\]+\[0-9\]+\[^\n\r\]+\[\n\r\]+" {
> + exp_continue
> + }
I think this changes the meaning of the test; you want to preserve the
heading match pattern at the very least. Also `gdb_test' handles various
error cases gracefully (which matters for the avoidance of excessive
timeouts with some test boards), whereas your simple matcher does not.
Also how many is "a lot"? Perhaps you could take the path of least
resistance instead and simply increase the size of the buffer, like with
commit ff604a674771 ("gdb/testsuite: Bump up `match_max'"). This could be
done temporarily for this test only, so as to avoid slowing down `expect'
throughout the test suite.
Maciej