This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA/dwarf] save nested Ada subprograms as global symbol


> > > 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]