Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: Re: [RFA/dwarf] save nested Ada subprograms as global symbol
Date: Wed, 30 Jan 2008 23:06:00 -0000	[thread overview]
Message-ID: <20080130225833.GG12387@adacore.com> (raw)
In-Reply-To: <20080130204208.GA3659@caradoc.them.org>

> > > 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.).
[...]
> I meant the unqualified names.  Are you likely to have a dozen
> different procedures in your program, all containing a nested method
> named "first"?

It's hard to tell. I would guess that nested subprograms are not
different in terms of naming from regular non-nested subprograms.

> Oh.  Well, that's much less reason to object then.  I thought you were
> putting "first" into the symbol table, but "pck.do_nothing.first" and
> then finding that on searches for "first" bothers me much less.

Ah, yes, I understand now where you are coming from. This is my fault,
I should have been more complete in my first message. Sometimes,
I overlook significant details that are obvious to me, but actually
not obvious to someone not familiar with the GNAT compiler...

> If you want to be able to use the name unqualified, then the global
> symbol table sounds like the right place to put it.  I'd like
> namespace members and procedures containing nested functions to be
> hierarchical elements in the symbol table, but that's not how it works
> today.

So is the original patch OK, then?

> I'd suggest we do the same for nested C functions but it would be a
> horrible mess; they don't have conveniently mangled or qualified names.

For purely-C nested functions, doesn't it work already? Actually,
I just gave it a try and I was able to break on my nested procedure.
Given:

    int
    main (void)
    {
       void do_nothing (void) {};
    
       do_nothing ();
       return 0;
    }

I was able to break on "do_nothing" and run to it:

    (gdb) b do_nothing
    Breakpoint 1 at 0x8048355: file foo.c, line 5.
    (gdb) run
    Starting program: /[...]/foo 
    
    Breakpoint 1, do_nothing () at foo.c:5
    5          void do_nothing (void) {};

-- 
Joel


  reply	other threads:[~2008-01-30 22:58 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
2008-01-30 20:42       ` Joel Brobecker
2008-01-30 21:03         ` Daniel Jacobowitz
2008-01-30 23:06           ` Joel Brobecker [this message]
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=20080130225833.GG12387@adacore.com \
    --to=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