gdb/testsuite: Introduce and use gdb_spawn_attach_cmdline
authorLancelot SIX <lancelot.six@amd.com>
Thu, 14 Apr 2022 09:41:48 +0000 (10:41 +0100)
committerLancelot SIX <lancelot.six@amd.com>
Wed, 20 Apr 2022 19:50:12 +0000 (20:50 +0100)
commitb750766ac9652def5307925b8fc5c215fbcef8df
tree5921a5a91ec3e2ac41b7388001f139c6ad47103b
parent4206d69e96ac401cf2975f37bf4e4d3a3c838313
gdb/testsuite: Introduce and use gdb_spawn_attach_cmdline

Following a7e6a19e87f3d719ea23c65b580a6d9bca4ccab3 "gdb: testsuite: add
new gdb_attach to check "attach" command", this commit proposes to
introduce the gdb_spawn_attach_cmdline helper and use it in
gdb.base/attach.exp.

This helper starts GDB and adds the "--pid=$PID" argument.

Also note that both the original and new implementation use
gdb_spawn_with_cmdline_opts, which in the end uses default_gdb_spawn.
This makes sure that we use $INTERNAL_GDBFLAGS, which by default already
contain "-iex \"set height 0\" -iex \"set width 0\"".  To avoid
repetition of those arguments, gdb_spawn_attach_cmdline does not repeat
those arguments.

To maintain a behavior similat to what gdb.base/attach.exp used to do,
gdb_spawn_attach_cmdline keeps the -quiet flag.

Tested on x86_64-gnu-linux

Change-Id: I1fdcdb71c86d9c5d34bb28fc86fac68bcec37358
gdb/testsuite/gdb.base/attach.exp
gdb/testsuite/lib/gdb.exp