public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix fail in gdb.server/solib-list.exp
@ 2016-07-14 15:53 Yao Qi
  2016-07-15  9:06 ` Yao Qi
  0 siblings, 1 reply; 3+ messages in thread
From: Yao Qi @ 2016-07-14 15:53 UTC (permalink / raw)
  To: gdb-patches

If I run single test solib-list.exp, it is OK.  If I run two, as below,
there are fails,

$ make check RUNTESTFLAGS="server-run.exp solib-list.exp"
FAIL: gdb.server/solib-list.exp: non-stop 0: continue (the program exited)
FAIL: gdb.server/solib-list.exp: non-stop 0: p libvar
FAIL: gdb.server/solib-list.exp: non-stop 1: continue (the program exited)
FAIL: gdb.server/solib-list.exp: non-stop 1: p libvar

in gdb.log,

/scratch/yao/gdb/build-git/x86_64/gdb/testsuite/../../gdb/gdbserver/gdbserver --once :2347 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.server/server-run/server-run /lib64/ld-linux-x86-64.so.2 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.server/solib-list/solib-list

server-run is spawned, which is wrong.  If I only run solib-list.exp, ld-linux
is spawned, which is right.

/scratch/yao/gdb/build-git/x86_64/gdb/testsuite/../../gdb/gdbserver/gdbserver --once :2346 /lib64/ld-linux-x86-64.so.2 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.server/solib-list/solib-list

in test, we spawn gdbserver this way,

    # Note we pass ${interp_system}, the program gdbserver spawns, as
    # argument here, instead of using gdb_load, because we don't want
    # to download the interpreter to the target (it's already there)
    # or to the test output directory.
    set res [gdbserver_spawn "${interp_system} ${remote_binfile}"]

in gdbserver_spawn -> gdbserver_download_current_prog, if
last_loaded_file is set (when you run multiple tests), it is
returned.

This patch is to unset last_loaded_file in solib-list.exp.

gdb/testsuite:

2016-07-14  Yao Qi  <yao.qi@linaro.org>

	* gdb.server/solib-list.exp: Unset last_loaded_file if it
	exists.
---
 gdb/testsuite/gdb.server/solib-list.exp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gdb/testsuite/gdb.server/solib-list.exp b/gdb/testsuite/gdb.server/solib-list.exp
index 5347f18..55a6fac 100644
--- a/gdb/testsuite/gdb.server/solib-list.exp
+++ b/gdb/testsuite/gdb.server/solib-list.exp
@@ -71,6 +71,12 @@ foreach nonstop { 0 1 } { with_test_prefix "non-stop $nonstop" {
     # displaced-stepping buffer at unmapped that time address _start.
     gdb_test "set displaced-stepping off"
 
+    # Unset last_loaded_file because we want GDBserver spawn
+    # ${interp_system} not ${last_loaded_file}.
+    global last_loaded_file
+    if { [info exists last_loaded_file] } {
+	unset last_loaded_file
+    }
     # Note we pass ${interp_system}, the program gdbserver spawns, as
     # argument here, instead of using gdb_load, because we don't want
     # to download the interpreter to the target (it's already there)
-- 
1.9.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix fail in gdb.server/solib-list.exp
  2016-07-14 15:53 [PATCH] Fix fail in gdb.server/solib-list.exp Yao Qi
@ 2016-07-15  9:06 ` Yao Qi
  2016-07-21  8:19   ` Yao Qi
  0 siblings, 1 reply; 3+ messages in thread
From: Yao Qi @ 2016-07-15  9:06 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

Yao Qi <qiyaoltc@gmail.com> writes:

> +    # Unset last_loaded_file because we want GDBserver spawn
> +    # ${interp_system} not ${last_loaded_file}.
> +    global last_loaded_file
> +    if { [info exists last_loaded_file] } {
> +	unset last_loaded_file
> +    }

Keith told me that I can use "-nocomplain" to avoid "info exists".
Patch is updated below,

-- 
Yao (齐尧)
From 2f20ad029eb9fa2b29b2118bd03a213301f65655 Mon Sep 17 00:00:00 2001
From: Yao Qi <yao.qi@linaro.org>
Date: Thu, 14 Jul 2016 16:47:38 +0100
Subject: [PATCH] Fix fail in gdb.server/solib-list.exp

If I run single test solib-list.exp, it is OK.  If I run two, as below,
there are fails,

$ make check RUNTESTFLAGS="server-run.exp solib-list.exp"
FAIL: gdb.server/solib-list.exp: non-stop 0: continue (the program exited)
FAIL: gdb.server/solib-list.exp: non-stop 0: p libvar
FAIL: gdb.server/solib-list.exp: non-stop 1: continue (the program exited)
FAIL: gdb.server/solib-list.exp: non-stop 1: p libvar

in gdb.log,

/scratch/yao/gdb/build-git/x86_64/gdb/testsuite/../../gdb/gdbserver/gdbserver --once :2347 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.server/server-run/server-run /lib64/ld-linux-x86-64.so.2 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.server/solib-list/solib-list

server-run is spawned, which is wrong.  If I only run solib-list.exp, ld-linux
is spawned, which is right.

/scratch/yao/gdb/build-git/x86_64/gdb/testsuite/../../gdb/gdbserver/gdbserver --once :2346 /lib64/ld-linux-x86-64.so.2 /scratch/yao/gdb/build-git/x86_64/gdb/testsuite/outputs/gdb.server/solib-list/solib-list

in test, we spawn gdbserver this way,

    # Note we pass ${interp_system}, the program gdbserver spawns, as
    # argument here, instead of using gdb_load, because we don't want
    # to download the interpreter to the target (it's already there)
    # or to the test output directory.
    set res [gdbserver_spawn "${interp_system} ${remote_binfile}"]

in gdbserver_spawn -> gdbserver_download_current_prog, if
last_loaded_file is set (when you run multiple tests), it is
returned.

This patch is to unset last_loaded_file in solib-list.exp.

gdb/testsuite:

2016-07-14  Yao Qi  <yao.qi@linaro.org>

	* gdb.server/solib-list.exp: Unset last_loaded_file.

diff --git a/gdb/testsuite/gdb.server/solib-list.exp b/gdb/testsuite/gdb.server/solib-list.exp
index 5347f18..57647e1 100644
--- a/gdb/testsuite/gdb.server/solib-list.exp
+++ b/gdb/testsuite/gdb.server/solib-list.exp
@@ -71,6 +71,11 @@ foreach nonstop { 0 1 } { with_test_prefix "non-stop $nonstop" {
     # displaced-stepping buffer at unmapped that time address _start.
     gdb_test "set displaced-stepping off"
 
+    # Unset last_loaded_file because we want GDBserver spawn
+    # ${interp_system} not ${last_loaded_file}.
+    global last_loaded_file
+    unset -nocomplain last_loaded_file
+
     # Note we pass ${interp_system}, the program gdbserver spawns, as
     # argument here, instead of using gdb_load, because we don't want
     # to download the interpreter to the target (it's already there)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix fail in gdb.server/solib-list.exp
  2016-07-15  9:06 ` Yao Qi
@ 2016-07-21  8:19   ` Yao Qi
  0 siblings, 0 replies; 3+ messages in thread
From: Yao Qi @ 2016-07-21  8:19 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

On Fri, Jul 15, 2016 at 10:06 AM, Yao Qi <qiyaoltc@gmail.com> wrote:
> Yao Qi <qiyaoltc@gmail.com> writes:
>
> gdb/testsuite:
>
> 2016-07-14  Yao Qi  <yao.qi@linaro.org>
>
>         * gdb.server/solib-list.exp: Unset last_loaded_file.

I pushed it in.

-- 
Yao (齐尧)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-21  8:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-14 15:53 [PATCH] Fix fail in gdb.server/solib-list.exp Yao Qi
2016-07-15  9:06 ` Yao Qi
2016-07-21  8:19   ` Yao Qi

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).