Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA/dwarf] save nested Ada subprograms as global symbol
Date: Tue, 29 Jan 2008 17:28:00 -0000	[thread overview]
Message-ID: <20080129171610.GE2815@caradoc.them.org> (raw)
In-Reply-To: <20071227073938.GC10767@adacore.com>

On Wed, Dec 26, 2007 at 11:39:38PM -0800, Joel Brobecker wrote:
> The problem is trying to break on First:
> 
>         % gdb hello
>         (gdb) break first
>         Function "first" not defined.
>         Make breakpoint pending on future shared library load? (y or [n]) n
> 
> What we'd like to be able to do is:
> 
>         (gdb) b first
>         Breakpoint 1 at 0x804954a: file hello.adb, line 6.
>         (gdb) run
>         Starting program: /home/no-backup/brobecke/ada-fsf/nested/hello 
>         
>         Breakpoint 1, hello.first () at hello.adb:6
>         6          end First;
> 
> To achieve this, we modified dwarf2read to store all Ada subprograms
> in the global scope, even the ones that are not "external". Another
> approach that was considered was to modify the Ada lookup routines
> to extend the search to non-global/static scopes, but I'm concerned
> about performance.
> 
> In practice, even though these routines are indeed local to our
> procedure in the Ada program, we want to be flexible with the user
> in the debugger, and treat these procedures as global, so that the
> user can break inside them without specifying the scope or having
> to be in the scope where the function is defined.

Sorry, I really don't like this idea.  What if you have a hello.first
and a goodbye.first?  They're not related, so a breakpoint on "first"
landing in both spots would be strange.

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.

-- 
Daniel Jacobowitz
CodeSourcery


  reply	other threads:[~2008-01-29 17:16 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 [this message]
2008-01-29 21:45   ` Joel Brobecker
2008-01-29 22:34     ` Daniel Jacobowitz
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=20080129171610.GE2815@caradoc.them.org \
    --to=drow@false.org \
    --cc=brobecker@adacore.com \
    --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