This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: GDB now takes 4 minutes to start up with remote gdbserver target
- From: Gary Benson <gbenson at redhat dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Sandra Loosemore <sandra at codesourcery dot com>, Paul_Koning at Dell dot com, gdb at sourceware dot org
- Date: Tue, 28 Jul 2015 10:25:07 +0100
- Subject: Re: GDB now takes 4 minutes to start up with remote gdbserver target
- Authentication-results: sourceware.org; auth=none
- References: <55B1768E dot 9090309 at codesourcery dot com> <55B1A4FC dot 9010403 at codesourcery dot com> <20150724085244 dot GB22673 at blade dot nx> <55B2444C dot 106 at codesourcery dot com> <2906903F-7478-4B9D-8A9A-A6256F8076EF at dell dot com> <20150724151148 dot GA18553 at blade dot nx> <FC7D3C21-A8E8-4316-8125-E9FCE152F5D0 at dell dot com> <55B26267 dot 4060905 at redhat dot com> <55B27348 dot 1020104 at codesourcery dot com> <20150727121454 dot GA15226 at blade dot nx>
Gary Benson wrote:
> Sandra Loosemore wrote:
> > On 07/24/2015 10:05 AM, Pedro Alves wrote:
> > > On 07/24/2015 04:27 PM, Paul_Koning@Dell.com wrote:
> > > > But having sysroot default to target is also a bad idea for lots
> > > > of other people. Consider embedded systems: you presumably have
> > > > stripped images there, but unstripped ones on your build host.
> > >
> > > But in that scenario, with the old default sysroot, how was gdb
> > > finding the binaries on the build host? The binaries on the
> > > equilalent locations on the host's root will certainly not match
> > > the embedded/target system's. In that scenario, you must have
> > > been pointing the "set sysroot" somewhere local? And if you do
> > > that, nothing changes in 7.10, gdb will still access the files on
> > > the local filesystem.
> > >
> > > From the discussion so far, it seems that the only case that ends
> > > up regressing is the case where the host and target share both the
> > > filesystem, and the host/target paths match. I don't know off
> > > hand how to make gdb aware of that automatically.
> >
> > There's also the case where the host and target sysroot locations do
> > not match at all. As I said, this used to work reasonably well for
> > application debugging, where the user isn't interested in debugging
> > shared libraries and doesn't care if the shared library symbol
> > information isn't available to GDB. It used to print a helpful
> > message suggesting using "set sysroot" if the user wants the shared
> > library information, instead of hanging on startup with no
> > indication of what the trouble is or how to fix it. I can't see the
> > new default behavior as an improvement over the old.
> >
> > > That seems like enough of a special case that could well be
> > > handled by an explicit "set sysroot /" in e.g., the toolchain's
> > > system-gdbinit, or by building gdb with "--with-sysroot=/".
> >
> > There are a bunch of possible workarounds for this, but why can't we
> > make GDB "just work" by default, as it used to, instead of requiring
> > users to build GDB differently or install a workaround or issue
> > extra commands manually that they didn't used to need at all?
>
> I have an idea for a solution to this. I should know in a few hours
> if it can work. Tomorrow morning at the very latest.
Ok, here goes...
* From a user's perspective GDB is magically prefixing *some*
executable and shared library filenames with "target:".
* From a developer's perspective this magic prefixing is implemented
by having the string "target:" as the default sysroot.
My proposal is to make the default sysroot be "" again, and add the
prefix in solib_find_1 if certain conditions are met, specifically:
* Executable filenames get prefixed with "target:" iff:
Automatic "target:" prefixing is enabled
AND gdb_sysroot is ""
AND the filesystem is nonlocal
* Shared library filenames get prefixed with "target:" iff:
Automatic "target:" prefixing is enabled
AND gdb_sysroot is ""
AND the filesystem is nonlocal
AND exec_filename starts with "target:"
There's a new boolean here, "set auto-target-prefix on|off", which
is enabled by default.
So:
gdb; target remote :9999 -> "target:" prefix applied
gdb FILE; target remote :9999 -> no "target:" prefix
The latter is how Sandra is invoking GDB. Also:
gdb -n PID, and
gdb; attach PID -> "target:" prefix applied iff FS is nonlocal
Aside from the fact that this should fix Sandra's use case without
breaking any I care about, I like that users doing non-remote, non-
container debugging will not see "target:" prefixes onscreen unless
they're actually necessary.
Comments?
Cheers,
Gary
--
http://gbenson.net/