[PATCH v3 2/2] Make gdbserver work with filename-only binaries

Metzger, Markus T markus.t.metzger@intel.com
Wed Feb 28 07:09:00 GMT 2018


Hello,

This ...

> > 0x000003fffdfd9280 in ?? () from target:/lib/ld64.so.1 Protocol error:
> > qXfer:btrace-conf (read-btrace-conf) conflicting enabled responses.

... is caused by a regression from removing the btrace_supported target
method for targets that do not define HAVE_LINUX_BTRACE.

A proposed fix is here:
https://sourceware.org/ml/gdb-patches/2018-02/msg00420.html

Maciej already noted the missing _() around string literals.

Regards,
Markus.

> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] On Behalf Of Simon Marchi
> Sent: 28 February 2018 06:33
> To: Sergio Durigan Junior <sergiodj@redhat.com>; GDB Patches <gdb-
> patches@sourceware.org>
> Cc: Pedro Alves <palves@redhat.com>; Joel Brobecker
> <brobecker@adacore.com>
> Subject: Re: [PATCH v3 2/2] Make gdbserver work with filename-only binaries
> 
> On 2018-02-27 10:58 PM, Sergio Durigan Junior wrote:
> > 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,
> >
> 
> Maybe it's just because of this issue?  Note the btrace-related error message.
> 
> https://sourceware.org/ml/gdb-patches/2018-02/msg00352.html
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


More information about the Gdb-patches mailing list