public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
To: Tom Tromey <tom@tromey.com>, Pedro Alves <palves@redhat.com>,
		jan.kratochvil@redhat.com
Cc: gdb-patches@sourceware.org
Subject: PING Re: [RFC] Have an option to tell GDB to detect and possibly handle mismatched exec-files.
Date: Wed, 03 Apr 2019 20:25:00 -0000	[thread overview]
Message-ID: <1554323097.1854.9.camel@skynet.be> (raw)
In-Reply-To: <1553106871.6197.31.camel@skynet.be>

Pedro/Jan,
Some feedback ?

Thanks

Philippe


On Wed, 2019-03-20 at 19:34 +0100, Philippe Waroquiers wrote:
> On Tue, 2019-03-19 at 10:43 -0600, Tom Tromey wrote:
> > > > > > > "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:
> > 
> > Philippe> A recurrent problem with GDB is that GDB uses the wrong exec-file
> > Philippe> when using the attach/detach commands sucessfully.
> > Philippe> Also, in case the user specifies a file on the command line but attaches
> > Philippe> to the wrong PID, this error is not made visible and gives a not user
> > Philippe> understandable behaviour.
> > 
> > I've been bitten any number of times by this.  So, it would be great to
> > have this fixed.
> > 
> > Philippe> There was a previous trial to fix this PR.
> > Philippe> See https://sourceware.org/ml/gdb-patches/2015-07/msg00118.html
> > Philippe> This trial was however only fixing the problem for the automatically
> > Philippe> determined executable files when doing attach.
> 
> I have re-read all the exchanges for the above fix trial.
> It ended up with the above msg00118 with Pedro asking 'WDYT?',
> and it looks like everybody was thinking nothing.
> So, after more than 4 years, here is some feedback :).
> 
> IMO, the distinction between auto-discovered and user-specified
> is artificial: if the user will debug a PID with what looks like a
> wrong executable specified by the user, GDB should not silently
> use the user provided file, as keeping it is very probably
> wrong (at least in the cases I have seen, it was always me
> doing an error, and the patch below will make the error visible
> and easy to fix) :
> The patch proposed below will indicate that there is very probably
> something weird, and then the user can change the setting and/or
> decide to not load the exec file discovered from the PID.
> 
> Also, the patch above makes GDB unconditionally switch of exec file
> for auto-discovered
> files.
> If ever the user really want to do something 'unusual', no way.
> Again, the patch
> below allows the user to control the behaviour
> if really something unusual is
> desired/needed.
> 
> > 
> > There was also this series:
> > 
> > https://sourceware.org/ml/gdb-patches/2014-03/msg00476.html
> > 
> > ... which seemingly went through at least 4 rounds of review and then
> > did not land for some reason.
> 
> After digging in the mail archive, it looks like the last state
> of this mail thread was the v5 done by Jan Kratochvil.
> I found no reaction to this v5.  No idea why it stalled.
> 
> That being said, I think that this last series does something different.
> IIUC, this patch series ensures that when GDB receives the pathname
> of a file to use (typically from a gdbserver), that GDB will use the
> build-id to decide to *not* load the debug info, but this does not
> lead to 'switch' to another correct exec-file.
> 
> In other words, this v5 ensures that GDB does not load wrong
> debug info for a file GDB has decided to use as exec-file (or library).
> It does not detect or report that a wrong file is selected for a PID.
> 
> In that sense, the patch proposed below is not contradictory with this
> last patch v5: once GDB has decided to use a certain exec-file,
> GDB today checks e.g. that the file has not changed of time stamp
> (otherwise it re-reads the file).  As I understand, the build-id is just
> a more sophisticated way to detect if the file loaded by the PID
> is consistent with either the reported file to use by GDB and/or with
> the separate debug info GDB finds on the host side.
> 
> > 
> > Before approving anything I would like to understand why neither of
> > these earlier attempts went in.
> > 
> > The build-id approach is appealing because (especially since the demise
> > of prelink) it seems that gdb could simply trust it and abandon
> > non-matching symbol files, without needing a "user supplied" bit.
> 
> In summary, I think that the patch below is another approach
> than the 'sticky user executable' concept, but does not aim at
> solving the problem of an exec-file or a remote exec-file
> inconsistent with some GDB host debug info.
> 
> 
> Philippe
> 
> 
> 

  reply	other threads:[~2019-04-03 20:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-18 22:58 Philippe Waroquiers
2019-03-19 16:43 ` Tom Tromey
2019-03-20 18:34   ` Philippe Waroquiers
2019-04-03 20:25     ` Philippe Waroquiers [this message]
2019-04-10 12:10       ` PING^2 " Philippe Waroquiers
2019-04-10 12:19         ` Pedro Alves
2019-07-05 19:49           ` PING^3 " Philippe Waroquiers
2019-08-07 19:43           ` PING^a long time ago ... Re: PING^2 " Philippe Waroquiers
2019-08-15 13:21             ` PING^4 " Philippe Waroquiers
2019-09-07 11:46           ` PING^6 " Philippe Waroquiers
2019-09-29 15:26           ` PING^7 " Philippe Waroquiers
2019-10-20 10:24             ` PING^8 " Philippe Waroquiers
2019-12-13 22:09               ` Tom Tromey

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=1554323097.1854.9.camel@skynet.be \
    --to=philippe.waroquiers@skynet.be \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=palves@redhat.com \
    --cc=tom@tromey.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).