]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[gdb/testsuite] Fix gdbserver pid in gdb.server/server-kill-python.exp
authorTom de Vries <tdevries@suse.de>
Wed, 17 Apr 2024 09:45:02 +0000 (11:45 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 17 Apr 2024 09:45:02 +0000 (11:45 +0200)
commit75d277b1f506dcfbedfee3bef078dfe2b484958b
tree41e07d5def6d730605936d34e33ecf92ee7d0076
parent0f077fcae0f1b090439169c471bba29b3be86615
[gdb/testsuite] Fix gdbserver pid in gdb.server/server-kill-python.exp

The commit ed32754a8c7 ("[gdb/testsuite] Fix gdb.server/multi-ui-errors.exp for
remote target") intended to addresss the problem that this command:
...
set gdbserver_pid [exp_pid -i $server_spawn_id]
...
does not return the pid of the gdbserver for remote target, but rather the one
of the ssh client session.

To fix this, it added another way of getting the gdbserver_pid.

For the trivial case of non-remote target, the PID found by either method
should be identical, but if we compare those by adding
"puts [exec ps -p $gdbserver_pid]" we get:
...
  PID TTY          TIME CMD
31711 pts/8    00:00:00 gdbserver
  PID TTY          TIME CMD
31718 pts/8    00:00:00 server-kill-pyt
...

The problem is that while the gdbserver PID is supposed to be read from the
result of "gdb.execute ('p server_pid')" in the python script, instead it's
taken from:
...
Process server-kill-python created; pid = 31718^M
...

Fix this by moving the printing of the gdbserver PID out of the python script.

Also double-check the two methods against each other, in the cases that they
should match.

Tested on x86_64-linux.

PR testsuite/31633
https://sourceware.org/bugzilla/show_bug.cgi?id=31633
gdb/testsuite/gdb.server/server-kill-python.exp