[review,gdb/testsuite] Fix UNRESOLVED in gdb.server/server-kill-python.exp

Message ID gerrit.1580512102000.Ic385e08cbd34cbf85518720cf5695b4ff6619f4b@gnutoolchain-gerrit.osci.io
State New
Headers show
Series
  • [review,gdb/testsuite] Fix UNRESOLVED in gdb.server/server-kill-python.exp
Related show

Commit Message

Simon Marchi (Code Review) Jan. 31, 2020, 11:08 p.m.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/760
......................................................................

[gdb/testsuite] Fix UNRESOLVED in gdb.server/server-kill-python.exp

The test-case gdb.server/server-kill-python.exp runs fine by itself:
...
Running src/gdb/testsuite/gdb.server/server-kill-python.exp ...

                === gdb Summary ===

nr of expected passes            3
...

But if we run f.i. gdb.server/file-transfer.exp before it, we get instead:
...
Running src/gdb/testsuite/gdb.server/server-kill-python.exp ...
ERROR: GDB process no longer exists

                === gdb Summary ===

nr of expected passes            13
nr of unresolved testcases       1
...

We can see the origin of the problem here:
...
spawn gdbserver --once localhost:2347 \
  build/gdb/testsuite/outputs/gdb.server/file-transfer/file-transfer \
  build/gdb/testsuite/outputs/gdb.server/server-kill-python/server-kill-python^M
Process build/gdb/testsuite/outputs/gdb.server/file-transfer/file-transfer
  \ created; pid = 9464^M
Listening on port 2347^M
...

The spawn of the gdbserver for the server-kill-python test-case gets as
executable argument the file-transfer binary.

This is caused by proc gdbserver_spawn attempting to load the exec file in
$file_last_loaded.  This is something that is meant to load the same exec in
the gdbserver that was earlier loaded into gdb.

In this test-case however, nothing has been loaded into gdb by the test-case,
and consequently we load the file that was loaded into gdb in the previous
test-case.

Fix this by unsetting $file_last_loaded before spawning gdbserver.

Build and reg-tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-01-31  Tom de Vries  <tdevries@suse.de>

	PR testsuite/25488
	* gdb.server/server-kill-python.exp: Unset $file_last_loaded before
	spawning gdbserver.

Change-Id: Ic385e08cbd34cbf85518720cf5695b4ff6619f4b
---
M gdb/testsuite/gdb.server/server-kill-python.exp
1 file changed, 3 insertions(+), 0 deletions(-)




-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Ic385e08cbd34cbf85518720cf5695b4ff6619f4b
Gerrit-Change-Number: 760
Gerrit-PatchSet: 1
Gerrit-Owner: Tom de Vries <tdevries@suse.de>
Gerrit-MessageType: newchange

Comments

Simon Marchi (Code Review) Jan. 31, 2020, 11:35 p.m. | #1
Simon Marchi has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/760
......................................................................


Patch Set 1:

Commit b1b53fb3ef077bf4412da53f0057b9c0e9ed4f3e added the same fix to gdb.server/solib-list.exp.  What would you think of unsetting last_loaded_file in gdb_init?  This is ran at the beginning of each test case, so I think it would be a better long-term fix, rather than patching each test case.


-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Ic385e08cbd34cbf85518720cf5695b4ff6619f4b
Gerrit-Change-Number: 760
Gerrit-PatchSet: 1
Gerrit-Owner: Tom de Vries <tdevries@suse.de>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Tom de Vries <tdevries@suse.de>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Comment-Date: Fri, 31 Jan 2020 23:35:37 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Simon Marchi (Code Review) Feb. 1, 2020, 12:29 a.m. | #2
Andrew Burgess has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/760
......................................................................


Patch Set 1:

> Patch Set 1:

> 

> Commit b1b53fb3ef077bf4412da53f0057b9c0e9ed4f3e added the same fix to gdb.server/solib-list.exp.  What would you think of unsetting last_loaded_file in gdb_init?  This is ran at the beginning of each test case, so I think it would be a better long-term fix, rather than patching each test case.


This sounds like a good idea to me.


-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Ic385e08cbd34cbf85518720cf5695b4ff6619f4b
Gerrit-Change-Number: 760
Gerrit-PatchSet: 1
Gerrit-Owner: Tom de Vries <tdevries@suse.de>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Tom de Vries <tdevries@suse.de>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Comment-Date: Sat, 01 Feb 2020 00:29:38 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Simon Marchi (Code Review) Feb. 1, 2020, 7:27 a.m. | #3
Tom de Vries has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/760
......................................................................


Patch Set 1:

> Patch Set 1:

> 

> > Patch Set 1:

> > 

> > Commit b1b53fb3ef077bf4412da53f0057b9c0e9ed4f3e added the same fix to gdb.server/solib-list.exp.  What would you think of unsetting last_loaded_file in gdb_init?  This is ran at the beginning of each test case, so I think it would be a better long-term fix, rather than patching each test case.

> 

> This sounds like a good idea to me.


Ack, that works, I'll test and resubmit.


-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Ic385e08cbd34cbf85518720cf5695b4ff6619f4b
Gerrit-Change-Number: 760
Gerrit-PatchSet: 1
Gerrit-Owner: Tom de Vries <tdevries@suse.de>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Tom de Vries <tdevries@suse.de>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Comment-Date: Sat, 01 Feb 2020 07:27:38 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Simon Marchi (Code Review) Feb. 10, 2020, 12:29 p.m. | #4
Tom de Vries has abandoned this change. ( https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/760 )

Change subject: [gdb/testsuite] Fix UNRESOLVED in gdb.server/server-kill-python.exp
......................................................................


Abandoned

Resumitted at https://sourceware.org/ml/gdb-patches/2020-02/msg00279.html
-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: Ic385e08cbd34cbf85518720cf5695b4ff6619f4b
Gerrit-Change-Number: 760
Gerrit-PatchSet: 2
Gerrit-Owner: Tom de Vries <tdevries@suse.de>
Gerrit-Reviewer: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Tom de Vries <tdevries@suse.de>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-MessageType: abandon

Patch

diff --git a/gdb/testsuite/gdb.server/server-kill-python.exp b/gdb/testsuite/gdb.server/server-kill-python.exp
index 71067e2..ae0eb2c 100644
--- a/gdb/testsuite/gdb.server/server-kill-python.exp
+++ b/gdb/testsuite/gdb.server/server-kill-python.exp
@@ -32,6 +32,9 @@ 
     return -1
 }
 
+global last_loaded_file
+unset -nocomplain last_loaded_file
+
 # Start gdbserver.
 set res [gdbserver_spawn "${binfile}"]
 set gdbserver_protocol [lindex $res 0]