From: Tom Tromey <tromey@redhat.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org, Sergio Durigan Junior <sergiodj@redhat.com>
Subject: Re: [PATCH 2/6] Introduce `pre_expanded sals'
Date: Fri, 29 Apr 2011 20:42:00 -0000 [thread overview]
Message-ID: <m3hb9gdc3k.fsf@fleche.redhat.com> (raw)
In-Reply-To: <201104181938.28644.pedro@codesourcery.com> (Pedro Alves's message of "Mon, 18 Apr 2011 19:38:28 +0100")
>>>>> "Pedro" == Pedro Alves <pedro@codesourcery.com> writes:
[...]
Pedro> This is why I proposed in the response to Jan, that if we want
Pedro> to group different "_source_ locations" under the same breakpoint,
Pedro> we implement it as a 3rd hierarchy, so you'd get:
Ok, I think I mostly understand this proposal.
I would like to work through this and come to some agreement, since I am
planning to implement the result -- not just for SystemTap probes but
also because I recently starting looking at an ambiguous name feature
request we've had open in RH bugzilla for far too long.
My current understanding is that an ambiguous linespec should cause
`break' to make a new "3rd-tier" breakpoint with sub-breakpoints for
each separate source location. These sub-breakpoints would have
canonicalized linespecs for better stable naming. Furthermore they
would be created and destroyed automatically in response to inferior
changes.
FWIW, I tend to think the 3-tier solution is too complicated. I think
having two ways that a breakpoint can have multiple locations will
confuse users.
Also, I came up with some cases I don't understand; I feel certain there
are more lurking.
Suppose the user does `break function' where `function' is *not*
ambiguous. This makes an ordinary breakpoint. Now suppose the inferior
calls dlopen and the new library has a definition of `function'. What
happens?
1. Breakpoint changes from ordinary to 3-tier.
2. We add logic to canonicalize the existing breakpoint's linespec
and do not set a new breakpoint.
3. We didn't make an ordinary breakpoint after all, all breakpoints are
3-tier.
Choice 1 seems potentially weird, though maybe it would work ok?
Choice 2 seems bad in some circumstances. `function' might be inlined
in some places, in which case you would actively want new breakpoint
locations to be set.
Choice 3 introduces complexity for all uses even though most breakpoints
aren't in fact ambiguous.
Here is an oddity: consider `break probe:something'. Now suppose this
probe was used in multiple locations -- one having debuginfo and two not
having debuginfo.
I think this implies that a 3-tier breakpoint must have one special
sub-breakpoint that collects locations from debuginfo-less matches. Or
perhaps each could be given its own sub-breakpoint -- but there is no
sensible way to provide canonical linespecs here, so matching won't
really work.
Suppose the inferior uses dlmopen and loads the same library twice. Now
there is really no way to canonicalize a linespec -- it can't even be
objfile-relative (postulate for a moment that there is a syntax for
this).
I think most of these cases are readily resolveable with the "break at
all matching locations" approach:
* Unambiguous -> ambiguous transition is no problem.
Breakpoint condition may no longer parse -- not super, but workable.
(As an aside: seeing those "can't parse" messages has bugged me in the
past, it seems like it would be good to have a way to tell GDB "if you
can't parse it, please stop right away so I can fix the darn thing".)
* The no-debuginfo SystemTap probe case: no problem in itself, and we
could simply mandate that such a breakpoint can only have certain
expressions attached (also mentioned below).
* dlmopen. Also no problem, the user asked for it :)
One advantage of 3-tier is that it does let you put different conditions
on different sub-breakpoints. (But the general idea of the simpler
approach is that you should disambiguate if you want tight control.
Which gives me the idea that we could make a new break command that does
just does automatically.)
I think either case will need some expansion of the matching heuristic
for breakpoints, and maybe some linespec additions to make it possible
to disambiguate more cases.
I am not very concerned about the MI problem. We can emit a new field
holding a vector of file:line locations, or something like that. Front
ends will adapt.
[...]
Pedro> You still have manifestations of the same problem. Location numbers are
Pedro> supposed to be stable. For example, users can enable/disable locations
Pedro> individually.
This problem is fundamental, just because there is no stable name for
source locations in the face of changes to the source. We are always
going to have heuristics in GDB, and some losing cases.
Pedro> See, "bp_location" concerns with address locations while the user
Pedro> the user is concerned about "source locations". I think that
Pedro> if "bp_location" had been named "bp_compiled_address", we wouldn't
Pedro> be having this discussion. :-)
For the SystemTap probe case in particular, I am not so sure.
I mean, I can see how it would be useful to an MI consumer if GDB
emitted file:line locations for all the locations hit by a "probe:"
breakpoint. This is not fundamental to one approach or the other, it
can be made to work.
I think it would be a reasonable choice on our part to simply mandate
that a SystemTap probe breakpoint have a single condition (for all
locations) which could only refer to globals and probe arguments.
Pedro> It's not necessarily a bad thing (and not necessarily a good thing
Pedro> either). If you have a big project, with a bunch of static
Pedro> "foo" functions, it's not unreasonable to have "b foo"
Pedro> break at the "closest" function with that name in your context.
Sure, but that isn't what actually happens. And, this would require
separate thinking. Like, suppose the "closest" metric yields an
ambiguous result, what should happen?
Pedro> What would "list parse_number" do if "break parse_number" breaks
Pedro> in all the instances of that static function?
Error or give a menu.
Tom
next prev parent reply other threads:[~2011-04-29 20:42 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-04 3:08 Sergio Durigan Junior
2011-04-06 20:13 ` Tom Tromey
2011-04-12 11:18 ` Pedro Alves
2011-04-12 11:53 ` Jan Kratochvil
2011-04-12 13:30 ` Pedro Alves
2011-04-12 20:34 ` Tom Tromey
2011-04-12 22:22 ` Matt Rice
2011-04-13 9:53 ` Eli Zaretskii
2011-07-27 17:08 ` Tom Tromey
2011-07-29 20:36 ` Sergio Durigan Junior
2011-08-04 20:41 ` Tom Tromey
2011-08-05 3:41 ` Sergio Durigan Junior
2011-08-05 14:40 ` Tom Tromey
2011-08-05 18:06 ` Sergio Durigan Junior
2011-08-10 14:24 ` Tom Tromey
2011-05-03 16:09 ` Jerome Guitton
2011-05-03 18:17 ` Joel Brobecker
2011-04-12 20:26 ` Tom Tromey
2011-04-13 9:51 ` Eli Zaretskii
2011-04-13 19:20 ` Tom Tromey
2011-04-15 10:37 ` Eli Zaretskii
2011-04-18 18:37 ` Pedro Alves
2011-04-27 18:02 ` Jan Kratochvil
2011-04-29 20:42 ` Tom Tromey [this message]
2011-04-11 21:08 ` Jan Kratochvil
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=m3hb9gdc3k.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.com \
--cc=sergiodj@redhat.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