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] fix Ada SYMBOL_PRINT_NAME problem


> > Trying to print "i" will result in the following menu:
> > 
> >     (gdb) print i
> >     Multiple matches for i
> >     [0] cancel
> >     [1] pck__first(int) at pck.adb:3
> >     [2] pck__second(int) at pck.adb:7
> >     >
> > 
> > The expected output (particularly for choices 1 and 2) is:
> > 
> >     (gdb) p i
> >     Multiple matches for i
> >     [0] cancel
> >     [1] pck.first.i at pck.adb:3
> >     [2] pck.second.i at pck.adb:7
[...]
> The clever demangling lookup table was clever for C++, but less clever
> for other languages; you'll see that Java already has some
> special-case code, and the comments there (e.g. about the msymbol
> having the wrong demangling) also apply to Ada.
> 
> I've no objection to this patch in principle, but you're doing it in
> the wrong place.  If you already know the symbol is an Ada symbol, why
> go through all the rigamarole of putting it in the hash table?

Duh! I feel ashamed I didn't think of that, and even more so that
it took me a long while to understand what you meant. Thanks for
the suggestion. I propose the following patch:

2008-01-30  Joel Brobecker  <brobecker@adacore.com>
                        
        * symtab.c (symbol_set_names): Do not add an entry in the demangling
        hash table for Ada symbols. Just store the linkage name as is,
        and leave the demangled_name as NULL.

Testcase unchanged:

2008-01-08  Joel Brobecker  <brobecker@adacore.com>

        * gdb.ada/sym_print_name: New test program.
        * gdb.ada/sym_print_name.exp: New testcase.

Does it look better? All tested on x86-linux, no regression.

Thanks,
-- 
Joel

Attachment: demangle.diff
Description: Text document

Attachment: demangle-tc.diff
Description: Text document


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