From: Daniel Jacobowitz <drow@false.org>
To: gdb-patches@sourceware.org
Subject: Re: [RFA/dwarf] save nested Ada subprograms as global symbol
Date: Tue, 29 Jan 2008 22:34:00 -0000 [thread overview]
Message-ID: <20080129221733.GI15063@caradoc.them.org> (raw)
In-Reply-To: <20080129214501.GF16288@adacore.com>
On Tue, Jan 29, 2008 at 01:45:01PM -0800, Joel Brobecker wrote:
> For Ada, the debugger takes the stand that there is an implicit
> "use" of all compilation units. The GDB manual documents this:
>
> Thus, for brevity, the debugger acts as if there were implicit with
> and use clauses in effect for all user-written packages, making it
> unnecessary to fully qualify most names with their packages,
> regardless of context. Where this causes ambiguity, GDB asks the
> user's intent.
>
> In the case of Hello.First and Goodbye.First, the user should expect
> that a breakpoint should be inserted in each function. If the user
> wants to specifically break on say Hello.First, then he should use
> its fully qualified name.
"for all user-written packages"; functions aren't packages, are they?
> > A related example in C++ would be:
> >
> > namespace A {
> > void first () { }
> >
> > void second () { first (); }
> > }
> >
> > int main()
> > {
> > A::second ();
> > }
> >
> > GDB will not honor "break first" when stopped in main. But in second,
> > when the listed source line says "first ();", "break first" will work.
> > David Carlton did a lot of work to make this happen; the hook it uses
> > is cp_lookup_symbol_nonlocal. In practice, it seems to be the
> > behavior users expect.
>
> To me, this makes the debugger unnecessarily harder to use. Why force
> the user to be inside a specific location before he can break on
> a function? Especially since the breakpoint will remain valid
> even after leaving the function's scope.
You don't have to be in second to break on first - sorry if that was
unclear. You have to be in second for "break first" to work. "break
A::first" always works.
> If I were to draw a parallel with our experience in Ada, we have
> found that the debugger is more useful when we allow the user to
> break on "first" from wherever. If the user wants to break on
> the specific function A::first, couldn't he use "break A::first"
> (not tried)?
Sure.
If I put a breakpoint on "search" from my application and GDB
also stopped at "std::search<Iter1, Iter2, Equals>" instantiated from
the Standard Template Library, I'd be very surprised. I said
"search", not "std::search", and GDB knows where to look for something
named "search"; if you haven't said "using std", it shouldn't search
std. But this is a fairly clear difference between the expectations
of C++ and Ada developers.
A closer analogy to nested procedures may be class methods. Are the
names of functions in packages normally relatively unique? How about
for nested functions? In C++, names within namespaces are relatively
unique, and method names are not ("next", "iterator", etc.).
Anyway, I'm certainly willing to follow your lead on what Ada users
expect. I'm wondering if I'm barking at the wrong part of your
message, though. Does the symbol for the nested subprogram end up
with an unqualified name (e.g., "first") in the global symbol table?
IMO the symbol table should reflect the program structure.
--
Daniel Jacobowitz
CodeSourcery
next prev parent reply other threads:[~2008-01-29 22:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-27 18:10 Joel Brobecker
2008-01-29 17:28 ` Daniel Jacobowitz
2008-01-29 21:45 ` Joel Brobecker
2008-01-29 22:34 ` Daniel Jacobowitz [this message]
2008-01-30 20:42 ` Joel Brobecker
2008-01-30 21:03 ` Daniel Jacobowitz
2008-01-30 23:06 ` Joel Brobecker
2008-01-30 23:57 ` Daniel Jacobowitz
2008-02-01 22:50 ` Joel Brobecker
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=20080129221733.GI15063@caradoc.them.org \
--to=drow@false.org \
--cc=gdb-patches@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