Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Doug Evans" <dje@google.com>
To: "Joel Brobecker" <brobecker@adacore.com>
Cc: "Aleksandar Ristovski" <ARistovski@qnx.com>,
	gdb@sourceware.org,         "Ryan Mansfield" <RMansfield@qnx.com>
Subject: Re: gdb_realpath: dealing with ./ and ../
Date: Mon, 07 Jan 2008 17:00:00 -0000	[thread overview]
Message-ID: <e394668d0801070900y6ea0df1ek5a654383376bc7f3@mail.gmail.com> (raw)
In-Reply-To: <20080107143212.GA5923@adacore.com>

On Jan 7, 2008 6:32 AM, Joel Brobecker <brobecker@adacore.com> wrote:
> The reason why I agree that the changes should be done inside
> start-subfiles is that we don't want to have to handle this sort of
> problem with every debug info reader.  This was, the handling is
> centralized. It also looks a lot simpler than the patches I have seen
> that touch the DWARF reader.

To what extent is the dwarf patch more complex because it handles the
possibility of multiple matches with the basename of the main source
file.  Assume there's only one file with the basename of the main file
name and things become a lot simpler.  See
http://sourceware.org/ml/gdb-patches/2008-01/msg00090.html.
One could rewrite that patch to keep dwarf2_start_subfile, but one
would have to pass an additional parameter so it would know if it's
dealing with the main source file.  The patch as submitted just
reorganizes things so that other solutions(/heuristics) are possible
without major reworking of the code (the patch itself had to do some
reworking, but once that's done it's done (in the problem space being
discussed)).  Plus it simplifies all call sites to
dwarf2_start_subfile/start_subfile.  Previously, each call site had to
process fe->dir_index, and there are three of them.

Handling the issue in each debug info reader is an important
consideration and may or may not be a problem.  One would need to
examine to what extent the issue exists in the other readers, and to
what extent start_subfile can solve it and still be debug-format
independent without being more complex.

> The one thing that this might break, however, is when the user
> provides a relative path in the break command:
>
>    (gdb) break bar/main.c
>
> As a matter of fact, this is already broken if DW_AT_name is main.c
> and not bar/main.c. So I'm pretty sure that it'll break it more.
> But the good news is that it would be easy to fix it: Modify the
> matching to concat the dirname and basename and do the match with
> that.
>
> Does this sound like it would work?

It seems like directory names need to be included in the file name
comparison by start_subfile to some extent, otherwise headers with the
same basename will match each other.

e.g.

a/foo.h:
int afoo () { return 0; }

b/foo.h:
int bfoo () { return 0; }

foo.c:
#include "a/foo.h"
#include "b/foo.h"
int main () { return afoo () + bfoo (); }


  reply	other threads:[~2008-01-07 17:00 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-03 17:07 Aleksandar Ristovski
2008-01-03 17:13 ` Daniel Jacobowitz
2008-01-07 14:33   ` Joel Brobecker
2008-01-07 17:00     ` Doug Evans [this message]
2008-01-08  5:46       ` Joel Brobecker
2008-01-08 19:54         ` Doug Evans
  -- strict thread matches above, loose matches on Subject: below --
2008-01-08 19:21 Aleksandar Ristovski
2008-01-08 16:12 Aleksandar Ristovski
2008-01-08 16:40 ` Mark Kettenis
2008-01-04 22:09 Aleksandar Ristovski
2008-01-04 20:16 Aleksandar Ristovski
2008-01-04 19:52 Aleksandar Ristovski
2008-01-04 20:30 ` Doug Evans
2008-01-04 17:04 Aleksandar Ristovski
2008-01-04 17:42 ` Daniel Jacobowitz
2008-01-04 18:25   ` Joel Brobecker
2008-01-04 21:40 ` Doug Evans
2008-01-04 21:48   ` Daniel Jacobowitz
2008-01-04 22:23     ` Doug Evans
2008-01-03 18:30 Aleksandar Ristovski
2008-01-04 12:52 ` Daniel Jacobowitz
2008-01-03 16:39 Aleksandar Ristovski
2008-01-03 16:52 ` Daniel Jacobowitz
2008-01-03 15:25 Aleksandar Ristovski
2008-01-03 16:00 ` Daniel Jacobowitz

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=e394668d0801070900y6ea0df1ek5a654383376bc7f3@mail.gmail.com \
    --to=dje@google.com \
    --cc=ARistovski@qnx.com \
    --cc=RMansfield@qnx.com \
    --cc=brobecker@adacore.com \
    --cc=gdb@sourceware.org \
    /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