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.
"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')
# 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