Make gdb.base/corefile.exp work on terminals with few rows
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 7 Feb 2019 14:22:29 +0000 (09:22 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Thu, 7 Feb 2019 14:22:29 +0000 (09:22 -0500)
commitbd447abb2442f74c2b4886f6cdacd16fce3c9d65
tree47f976f046a99638a1abdb8d45e0e750ae5cc8db
parent46e3ed7ff94dc2d65f3d937d483c459b4cee6a0a
Make gdb.base/corefile.exp work on terminals with few rows

When creating a pty to spawn a subprocess (such as gdb), Expect
copies the settings of its own controlling terminal, including the
number of rows and columns.  If you "make check" on a terminal with just
a few rows (e.g. 4), GDB will paginate before reaching the initial
prompt.  In default_gdb_start, used by most tests, this is already
handled: if we see the pagination prompt, we sent \n to continue.

Philippe reported that gdb.base/corefile.exp didn't work in terminals
with just a few rows.  This test spawns GDB by hand, because it needs to
check things before the initial prompt, which it couldn't do if it used
default_gdb_start.

In this case I think it's not safe to use the same technique as in
default_gdb_start.  Even if we could send a \n if we see a pagination
prompt, we match some multiline regexes in there.  So if a pagination
slips in there, it might make the regexes not match and fail the test.

It's also not possible to use -ex "set height 0" or -iex "set height 0",
it is handled after the introduction text is shown.

The simplest way I found to avoid showing the pagination completely is
to set stty_init (documented in expect's man page) to initialize gdb's
pty with a fixed number of rows.

And actually, if we set stty_init in gdb_init, it works nicely as a
general solution applicable to all tests.  We can therefore remove the
solution introduced in e882ef3cfc3 ("testsuite: expect possible
pagination when starting gdb") where we matched the pagination prompt
during startup.

gdb/testsuite/ChangeLog:

* lib/gdb.exp (default_gdb_start): Don't match pagination
prompt.
(gdb_init): Set stty_init.
gdb/testsuite/ChangeLog
gdb/testsuite/lib/gdb.exp
This page took 0.024867 seconds and 4 git commands to generate.