From patchwork Fri Apr 8 18:45:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 11675 Received: (qmail 44753 invoked by alias); 8 Apr 2016 18:45:12 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 44721 invoked by uid 89); 8 Apr 2016 18:45:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:5366 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 08 Apr 2016 18:45:09 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 81B687D0E6; Fri, 8 Apr 2016 18:45:08 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u38Ij7qU020239; Fri, 8 Apr 2016 14:45:07 -0400 Subject: [pushed] Fix gdb.server/solib-list.exp regression To: Simon Marchi , gdb-patches@sourceware.org References: <1460027557-20679-1-git-send-email-palves@redhat.com> <5706C3F8.8030405@ericsson.com> <5706E848.5080705@redhat.com> <5707F2C7.3070909@ericsson.com> From: Pedro Alves Message-ID: <5707FC33.1010302@redhat.com> Date: Fri, 8 Apr 2016 19:45:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <5707F2C7.3070909@ericsson.com> On 04/08/2016 07:04 PM, Simon Marchi wrote: > but it didn't work out of the box. I'll come back to it soon. Hopefully it won't be something too hard. > But in the mean time, > I think you can push your patch, which makes it work for you locally. Alright, pushed as below. Thanks again for the review, Simon. From 096be756aa7f10f1c757e4dcc216bf0076a194ea Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Thu, 7 Apr 2016 23:36:50 +0100 Subject: [PATCH] Fix gdb.server/solib-list.exp regression Commit 7817ea46148d (Improve gdb_remote_download, remove gdb_download) caused: FAIL: gdb.server/solib-list.exp: non-stop 0: target extended-remote (timeout) FAIL: gdb.server/solib-list.exp: non-stop 0: continue (the program is no longer running) FAIL: gdb.server/solib-list.exp: non-stop 0: p libvar FAIL: gdb.server/solib-list.exp: non-stop 1: target extended-remote (timeout) FAIL: gdb.server/solib-list.exp: non-stop 1: continue (the program is no longer running) FAIL: gdb.server/solib-list.exp: non-stop 1: p libvar gdb.log shows: system interpreter is: /lib64/ld-linux-x86-64.so.2 ... spawn ../gdbserver/gdbserver --once :2347 /home/pedro/brno/pedro/gdb/mygit/build/gdb/testsuite/outputs/gdb.server/solib-list/ld-linux-x86-64.so.2 /home/pedro/brno/pedro/gdb/mygit/build/gdb/testsuite/outputs/gdb.server/solib-list/solib-list Process /home/pedro/brno/pedro/gdb/mygit/build/gdb/testsuite/outputs/gdb.server/solib-list/ld-linux-x86-64.so.2 created; pid = 18637 Cannot exec /home/pedro/brno/pedro/gdb/mygit/build/gdb/testsuite/outputs/gdb.server/solib-list/ld-linux-x86-64.so.2: No such file or directory. ... The test copied the interpreter to the outputs directory, however ld-linux-x86-64.so.2 is a relative symlink that when copied points nowhere: $ ls -l testsuite/outputs/gdb.server/solib-list/ total 52 -rwxrwxr-x. 1 pedro pedro 13450 Apr 7 10:52 gdb.log -rw-rw-r--. 1 pedro pedro 1512 Apr 7 10:52 gdb.sum lrwxrwxrwx. 1 pedro pedro 10 Apr 7 11:39 ld-linux-x86-64.so.2 -> ld-2.22.so -rwxrwxr-x. 1 pedro pedro 9464 Apr 7 11:39 solib-list -rw-rw-r--. 1 pedro pedro 3472 Apr 7 11:39 solib-list-lib.c.o -rw-rw-r--. 1 pedro pedro 2760 Apr 7 11:39 solib-list.o -rwxrwxr-x. 1 pedro pedro 9232 Apr 7 11:39 solib-list.so The copying comes from gdbserver_spawn -> gdbserver_download_current_prog -> gdb_remote_download. There's actually no need to download the interpreter to the target - it's part of the target system/environment. So fix this by making the test just not use gdb_load (and gdb_file_cmd as consequence) at all, and instead pass the interpreter filename to gdbserver as an argument. gdb/testsuite/ChangeLog: 2016-04-08 Pedro Alves * gdb.server/solib-list.exp: Don't use gdb_load. Instead pass the interpreter filename as argument to gdbserver_spawn. * lib/gdbserver-support.exp (gdbserver_download_current_prog): Return empty if $last_loaded_file does not exist. --- gdb/testsuite/ChangeLog | 7 +++++++ gdb/testsuite/gdb.server/solib-list.exp | 9 ++++++--- gdb/testsuite/lib/gdbserver-support.exp | 4 ++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 3c9f20c..2ecc1e0 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2016-04-08 Pedro Alves + + * gdb.server/solib-list.exp: Don't use gdb_load. Instead pass the + interpreter filename as argument to gdbserver_spawn. + * lib/gdbserver-support.exp (gdbserver_download_current_prog): + Return empty if $last_loaded_file does not exist. + 2016-04-08 Jan Kratochvil Fix compatibility with gcc-4.8.5-4.el7.x86_64. diff --git a/gdb/testsuite/gdb.server/solib-list.exp b/gdb/testsuite/gdb.server/solib-list.exp index fcd6d25..9d5cdcc 100644 --- a/gdb/testsuite/gdb.server/solib-list.exp +++ b/gdb/testsuite/gdb.server/solib-list.exp @@ -57,7 +57,6 @@ foreach nonstop { 0 1 } { with_test_prefix "non-stop $nonstop" { gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir - gdb_load ${interp_system} gdb_load_shlibs ${binfile} gdb_load_shlibs ${binlibfile} @@ -72,8 +71,12 @@ foreach nonstop { 0 1 } { with_test_prefix "non-stop $nonstop" { # But GDB having symbols from the main executable it would try to use # displaced-stepping buffer at unmapped that time address _start. gdb_test "set displaced-stepping off" - - set res [gdbserver_spawn ${binfile}] + + # 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} ${binfile}"] set gdbserver_protocol [lindex $res 0] set gdbserver_gdbport [lindex $res 1] diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp index 67a8333..951afe5 100644 --- a/gdb/testsuite/lib/gdbserver-support.exp +++ b/gdb/testsuite/lib/gdbserver-support.exp @@ -155,6 +155,10 @@ proc gdbserver_download_current_prog { } { global gdbserver_server_exec global last_loaded_file + if { ![info exists last_loaded_file] } { + return "" + } + set host_exec $last_loaded_file # If we already downloaded a file to the target, see if we can reuse it.