public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 1/2] [gdb/testsuite] Simplify gdb.server/server-kill-python.exp
Date: Fri, 12 Apr 2024 19:51:00 +0200	[thread overview]
Message-ID: <20240412175101.9154-1-tdevries@suse.de> (raw)

In test-case gdb.server/server-kill-python.exp we have:
...
if {[gdb_spawn_with_cmdline_opts \
         "-quiet -iex \"set height 0\" -iex \"set width 0\" -ex \"source $host_file1\""] != 0} {
    fail "spawn"
    return
}
...

I reproduced the problem by reverting the fix at the commit adding both the
fix and the test-case, and the reproduced the same problem using:
...
(gdb) source $host_file1
...
so there doesn't seem to be a specific need to source the python file using
"-ex".

Simplify the test-case by sourcing the python file using send_gdb.

This also allow us to simplify the python script.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.server/server-kill-python.exp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.server/server-kill-python.exp b/gdb/testsuite/gdb.server/server-kill-python.exp
index ebf6176ebba..87f9b56bd39 100644
--- a/gdb/testsuite/gdb.server/server-kill-python.exp
+++ b/gdb/testsuite/gdb.server/server-kill-python.exp
@@ -48,8 +48,6 @@ puts $fd \
 "import gdb
 
 def do_gdb_stuff ():
-    gdb.execute ('file $host_binfile')
-    gdb.execute ('target $gdbserver_protocol $gdbserver_gdbport')
     gdb.execute ('break $srcfile:$break_linenr')
     gdb.execute ('continue')
     gdb.execute ('p server_pid')
@@ -63,11 +61,15 @@ set host_file1 [gdb_remote_download host $file1]
 # Now start GDB, sourcing the python command file we generated above.
 # Set the height and width so we don't end up at a paging prompt.
 if {[gdb_spawn_with_cmdline_opts \
-	 "-quiet -iex \"set height 0\" -iex \"set width 0\" -ex \"source $host_file1\""] != 0} {
+	 "-quiet -iex \"set height 0\" -iex \"set width 0\""] != 0} {
     fail "spawn"
     return
 }
 
+gdb_load $binfile
+gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport
+send_gdb "source $host_file1\n"
+
 # Get the gdbserver PID.
 set gdbserver_pid 0
 

base-commit: 3d67591c6ff0443e36cbc38ece082cc240e87bf6
-- 
2.35.3


             reply	other threads:[~2024-04-12 17:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12 17:51 Tom de Vries [this message]
2024-04-12 17:51 ` [PATCH 2/2] [gdb/testsuite] Fix gdbserver pid in gdb.server/server-kill-python.exp Tom de Vries
2024-04-16 17:21 ` [PATCH 1/2] [gdb/testsuite] Simplify gdb.server/server-kill-python.exp Tom Tromey
2024-04-17  9:48   ` Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240412175101.9154-1-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).