From b750766ac9652def5307925b8fc5c215fbcef8df Mon Sep 17 00:00:00 2001 From: Lancelot SIX Date: Thu, 14 Apr 2022 10:41:48 +0100 Subject: 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 | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'gdb/testsuite/gdb.base/attach.exp') diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp index d01060a..7b661e9 100644 --- a/gdb/testsuite/gdb.base/attach.exp +++ b/gdb/testsuite/gdb.base/attach.exp @@ -467,14 +467,9 @@ proc_with_prefix do_command_attach_tests {} { gdb_exit - set res [gdb_spawn_with_cmdline_opts \ - "-quiet -iex \"set height 0\" -iex \"set width 0\" --pid=$testpid"] - set test "starting with --pid" - gdb_test_multiple "" $test { - -re "Reading symbols from.*$gdb_prompt $" { - pass "$test" - } - } + # gdb_spawn_attach_cmdline records test results. No need to explicitly + # call pass/fail here. + gdb_spawn_attach_cmdline $testpid # Get rid of the process kill_wait_spawned_process $test_spawn_id -- cgit v1.1