From: Keith Seitz <keiths@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>,
gdb-patches@sourceware.org, sergiodj@redhat.com,
Yao Qi <yao@codesourcery.com>,
Pedro Alves <palves@redhat.com>
Subject: Re: RFC: branching for GDB 7.11 soon? (possibly Wed)
Date: Mon, 01 Feb 2016 19:51:00 -0000 [thread overview]
Message-ID: <56AFB750.3030702@redhat.com> (raw)
In-Reply-To: <20160201030638.GG4008@adacore.com>
On 01/31/2016 07:06 PM, Joel Brobecker wrote:
>
> PR19474 "break LINE_NUM" set breakpoint on file other than current source file
> (suggest Keith?)
> At the moment, I would be hesitant to branch before we first
> analyze what would be required to fix PR19474 ("break LINE_NUM").
> But if we're confident that it can be fairly safely fixed on
> the branch, I don't see any other issue blocking for branching,
> which I would then propose to be doing sometime early Wed.
I started looking at this last week, and I have an analysis of the
problems. It all basically boils down to: we cannot (reliably) win in
this situation.
Reminder of the situation from the bug: We have the two symtabs
/home/keiths/tmp/f.c and /home/keiths/tmp/foo/f.c. This later symtab
exists on the disk, though, as /home/keiths/tmp/bar/f.c.
In create_sals_line_offset, we get the current source symtab and then
search for all symtabs matching that name. This is required because we
may have multiple symtabs for the same source file. [See
expand-psymtabs.exp for an example.]
When we go looking for the psymtab, we call psymtab_to_fullname, which
uses find_and_open_source to search the source path, which includes
/home/keiths/tmp/foo (the CDIR) and CWD.
This last bit is the problem. If the user's CWD is /home/keiths/tmp,
openp will return that /home/keiths/tmp/f.c is a match for the requested
symtab filename, /home/keiths/tmp/foo/f.c. This is clearly incorrect.
The two source files are /not/ the same, but find_and_open_source
returns that it found the foo/f.c symtab even when it didn't. [When sal
conversion is complete, gdb will look up the symtab name by PC, it then
finds the "correct" symtab for reporting during "info break."]
So, yes, this bug can be worked around by NOT having your CWD set to
/home/keiths/tmp. A simple "cd .." will "fix" things. Ouch!
Aside: It seems to me that instead of doing basename searches and using
CWD, this whole thing should really do/support directory mappings, e.g.,
the user can say, "whenever you see /home/keiths/tmp/foo, look instead
in /home/keiths/tmp/bar." But I don't think that really addresses the
problem at hand.
The only solution I've come up with is changing the whole API so that in
this specific case (searching for a known symtab), we reject searching
the source path. As you can imagine, that could open up an entirely new
"can of worms." [And that change would be quite intrusive.]
Like Yao, I'm not entirely sure what to do here yet.
Keith
next prev parent reply other threads:[~2016-02-01 19:51 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-01 3:06 Joel Brobecker
2016-02-01 13:34 ` Pedro Alves
2016-02-01 17:04 ` Pedro Alves
2016-02-01 19:51 ` Keith Seitz [this message]
2016-02-04 0:45 ` [RFC] breakpoints/19474 [was Re: RFC: branching for GDB 7.11 soon? (possibly Wed)] Keith Seitz
2016-02-04 1:33 ` Keith Seitz
2016-02-04 11:05 ` Yao Qi
2016-02-04 12:31 ` Pedro Alves
2016-08-12 12:00 ` Yao Qi
2016-02-07 8:12 ` RFC: branching for GDB 7.11 soon? (possibly Wed) Joel Brobecker
2016-02-08 18:03 ` Sergio Durigan Junior
2016-02-08 19:28 ` Keith Seitz
2016-02-08 20:06 ` Pedro Alves
2016-02-08 20:11 ` Keith Seitz
2016-02-09 5:35 ` Sergio Durigan Junior
2016-02-09 14:15 ` Simon Marchi
2016-02-09 14:18 ` Pedro Alves
2016-02-09 14:52 ` Simon Marchi
2016-02-09 18:31 ` Sergio Durigan Junior
2016-02-09 11:56 ` Joel Brobecker
2016-02-09 12:37 ` Pedro Alves
2016-02-09 22:37 ` Keith Seitz
2016-02-10 3:40 ` Joel Brobecker
2016-02-10 10:04 ` Pedro Alves
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=56AFB750.3030702@redhat.com \
--to=keiths@redhat.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
--cc=sergiodj@redhat.com \
--cc=yao@codesourcery.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