From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 51889 invoked by alias); 28 Feb 2018 03:58:18 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 51879 invoked by uid 89); 28 Feb 2018 03:58:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-8.4 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,RCVD_IN_DNSWL_LOW,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=headaches, Ending X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 28 Feb 2018 03:58:15 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3F3B88182D01; Wed, 28 Feb 2018 03:58:14 +0000 (UTC) Received: from localhost (unused-10-15-17-196.yyz.redhat.com [10.15.17.196]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2397F946A5; Wed, 28 Feb 2018 03:58:14 +0000 (UTC) From: Sergio Durigan Junior To: GDB Patches Cc: Simon Marchi , Pedro Alves , Joel Brobecker Subject: Re: [PATCH v3 2/2] Make gdbserver work with filename-only binaries References: <20180210014241.19278-3-sergiodj@redhat.com> <20180228032708.19670-1-sergiodj@redhat.com> <20180228032708.19670-3-sergiodj@redhat.com> Date: Wed, 28 Feb 2018 03:58:00 -0000 In-Reply-To: <20180228032708.19670-3-sergiodj@redhat.com> (Sergio Durigan Junior's message of "Tue, 27 Feb 2018 22:27:08 -0500") Message-ID: <87h8q1oje2.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2018-02/txt/msg00444.txt.bz2 On Tuesday, February 27 2018, I wrote: > Simon mentioned on IRC that, after the startup-with-shell feature has > been implemented on gdbserver, it is not possible to specify a > filename-only binary, like: > > $ gdbserver :1234 a.out > /bin/bash: line 0: exec: a.out: not found > During startup program exited with code 127. > Exiting > > This happens on systems where the current directory "." is not listed > in the PATH environment variable. Although including "." in the PATH > variable is a possible workaround, this can be considered a regression > because before startup-with-shell it was possible to use only the > filename (due to reason that gdbserver used "exec*" directly). > > The idea of the patch is to verify if the program path provided by the > user (or by the remote protocol) contains a directory separator > character. If it doesn't, it means we're dealing with a filename-only > binary, so we call "gdb_abspath" to properly expand it and transform > it into a full path. Otherwise, we leave the program path untouched. > This mimicks the behaviour seen on GDB (look at "openp" and > "attach_inferior", for example). > > I am also submitting a testcase which exercises the scenario described > above. This test requires gdbserver to be executed in a different CWD > than the original, so I also created a helper function, "with_cwd" (on > testsuite/lib/gdb.exp), which takes care of cd'ing into and out of the > specified dir. This part is still giving me a few headaches. I've just noticed that two builders reported the new test as FAIL. When I run it here, I can't reproduce it, which makes me wonder that it's racy. I don't know if the culprit is the new "with_cwd" logic or not. Curiously, both builders reporting the failure are running on s390x (Debian-s390x-native-extended-gdbserver-m64 and RHEL-s390x-m64). Here's an excerpt of report from one of them, Debian-s390x-native-extended-gdbserver-m64: ---------------- (gdb) file /home/dje/debian-jessie-s390x-1/debian-s390x-native-extended-gdbserver/build/gdb/testsuite/outputs/gdb.server/abspath/abspath Reading symbols from /home/dje/debian-jessie-s390x-1/debian-s390x-native-extended-gdbserver/build/gdb/testsuite/outputs/gdb.server/abspath/abspath...done. (gdb) set remote exec-file /home/dje/debian-jessie-s390x-1/debian-s390x-native-extended-gdbserver/build/gdb/testsuite/outputs/gdb.server/abspath/abspath (gdb) set remote exec-file /home/dje/debian-jessie-s390x-1/debian-s390x-native-extended-gdbserver/build/gdb/testsuite/outputs/gdb.server/abspath/abspath (gdb) disconnect Ending remote debugging. (gdb) PASS: gdb.server/abspath.exp: disconnect Switching to directory /home/dje/debian-jessie-s390x-1/debian-s390x-native-extended-gdbserver/build/gdb/testsuite/outputs/gdb.server/abspath (saved CWD: /home/dje/debian-jessie-s390x-1/debian -s390x-native-extended-gdbserver/build/gdb/testsuite). spawn /home/dje/debian-jessie-s390x-1/debian-s390x-native-extended-gdbserver/build/gdb/testsuite/../gdbserver/gdbserver --once :2347 abspath Can't bind address: Address already in use. Exiting Port 2347 is already in use. spawn /home/dje/debian-jessie-s390x-1/debian-s390x-native-extended-gdbserver/build/gdb/testsuite/../gdbserver/gdbserver --once :2348 abspath Process /home/dje/debian-jessie-s390x-1/debian-s390x-native-extended-gdbserver/build/gdb/testsuite/outputs/gdb.server/abspath/abspath created; pid = 21406 Listening on port 2348 target extended-remote localhost:2348 Remote debugging using localhost:2348 Reading /lib/ld64.so.1 from remote target... warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead. Reading /lib/ld64.so.1 from remote target... Reading symbols from target:/lib/ld64.so.1...Reading /lib/ld-2.19.so from remote target... Reading /lib/.debug/ld-2.19.so from remote target... (no debugging symbols found)...done. 0x000003fffdfd9280 in ?? () from target:/lib/ld64.so.1 Protocol error: qXfer:btrace-conf (read-btrace-conf) conflicting enabled responses. (gdb) break main Breakpoint 1 at 0x800005bc: file /home/dje/debian-jessie-s390x-1/debian-s390x-native-extended-gdbserver/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.server/normal.c, line 23. (gdb) continue The program is not being run. (gdb) FAIL: gdb.server/abspath.exp: continue to main (the program is no longer running) Switching back to /home/dje/debian-jessie-s390x-1/debian-s390x-native-extended-gdbserver/build/gdb/testsuite. ---------------- They're both running the testsuite in parallel mode (-j8), but when I run it locally in parallel I can't reproduce (even when I run in a loop). Anyway, I'll try to find out why this happens. I don't see how changing the CWD in a test could impact its results, so I'm guessing there's something else at play here. Thanks, -- Sergio GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36 Please send encrypted e-mail if possible http://sergiodj.net/