public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Sergio Durigan Junior <sergiodj@redhat.com>
To: GDB Patches <gdb-patches@sourceware.org>
Cc: Simon Marchi <simon.marchi@ericsson.com>,
	 Pedro Alves <palves@redhat.com>,
	 Joel Brobecker <brobecker@adacore.com>
Subject: Re: [PATCH v3 2/2] Make gdbserver work with filename-only binaries
Date: Wed, 28 Feb 2018 03:58:00 -0000	[thread overview]
Message-ID: <87h8q1oje2.fsf@redhat.com> (raw)
In-Reply-To: <20180228032708.19670-3-sergiodj@redhat.com> (Sergio Durigan	Junior's message of "Tue, 27 Feb 2018 22:27:08 -0500")

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/

  reply	other threads:[~2018-02-28  3:58 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-10  1:42 [PATCH 0/2] " Sergio Durigan Junior
2018-02-10  1:42 ` [PATCH 2/2] " Sergio Durigan Junior
2018-02-12  4:18   ` Simon Marchi
2018-02-12 19:16     ` Sergio Durigan Junior
2018-02-21  8:05       ` Joel Brobecker
2018-02-12 19:57   ` [PATCH 0/2] " Sergio Durigan Junior
2018-02-12 19:57     ` [PATCH v2 2/2] " Sergio Durigan Junior
2018-02-13  4:35       ` Simon Marchi
2018-02-22 18:37         ` Sergio Durigan Junior
2018-02-21 12:29       ` Pedro Alves
2018-02-27  0:20         ` Sergio Durigan Junior
2018-02-28  3:32           ` Sergio Durigan Junior
2018-02-12 19:57     ` [PATCH v2 1/2] Create new common/pathstuff.[ch] Sergio Durigan Junior
2018-02-28  3:27   ` [PATCH v3 0/2] Make gdbserver work with filename-only binaries Sergio Durigan Junior
2018-02-28  3:27     ` [PATCH v3 2/2] " Sergio Durigan Junior
2018-02-28  3:58       ` Sergio Durigan Junior [this message]
2018-02-28  5:33         ` Simon Marchi
2018-02-28  7:09           ` Metzger, Markus T
2018-02-28 16:30             ` Sergio Durigan Junior
2018-02-28  5:46       ` Simon Marchi
2018-02-28 16:29         ` Sergio Durigan Junior
2018-02-28 16:40           ` Sergio Durigan Junior
2018-02-28  3:27     ` [PATCH v3 1/2] Create new common/pathstuff.[ch] Sergio Durigan Junior
2018-02-28  5:02       ` Simon Marchi
2018-02-28 16:46         ` Sergio Durigan Junior
2018-02-28 16:39       ` Sergio Durigan Junior
2018-03-01  2:23     ` [PATCH v3 0/2] Make gdbserver work with filename-only binaries Sergio Durigan Junior
2018-03-01  2:55       ` Joel Brobecker
2018-03-01 13:08         ` Christophe Lyon
2018-03-01 13:18           ` Simon Marchi
2018-03-01 19:50           ` Sergio Durigan Junior
2018-03-01 20:20           ` [PATCH] Conditionally include "<windows.h>" on common/pathstuff.c (and unbreak build on mingw*) Sergio Durigan Junior
2018-03-01 20:47             ` Simon Marchi
2018-03-02 11:46               ` Christophe Lyon
2018-03-02 12:35                 ` Sergio Durigan Junior
2018-03-02 11:11             ` Yao Qi
2018-03-02 12:29               ` Sergio Durigan Junior
2018-03-02 12:37                 ` Sergio Durigan Junior
2018-03-05 12:07                   ` Yao Qi
2018-03-02 13:32             ` Eli Zaretskii
2018-03-02 15:15               ` Simon Marchi
2018-03-02 18:20                 ` Sergio Durigan Junior
2018-03-03  7:36                   ` Eli Zaretskii
2018-03-01 17:37         ` [PATCH v3 0/2] Make gdbserver work with filename-only binaries Sergio Durigan Junior
2018-03-02  3:20           ` Joel Brobecker
2018-02-28 16:47   ` [obvious/pushed] Change order of error message printed when gdbserver can't find CWD Sergio Durigan Junior
2018-02-10  1:42 ` [PATCH 1/2] Create new common/pathstuff.[ch] Sergio Durigan Junior
2018-02-11 22:14   ` Simon Marchi
2018-02-12 19:01     ` Sergio Durigan Junior
2018-02-21  7:56   ` Joel Brobecker
2018-02-22 18:43     ` Sergio Durigan Junior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h8q1oje2.fsf@redhat.com \
    --to=sergiodj@redhat.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=simon.marchi@ericsson.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).