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] |
Hello, The debugger sometimes prints weird names for certain Ada entities. This shows up inside multiple-choice menus printed when an expression is ambiguous. For instance, given the following two variables declared with the same name but in a different (global) scope: package First is I : Integer := 1; end First; package Second is I : Integer := 2; end Second; 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 > What happened in our case is that symtab.c:symbol_natural_name checks for gsymbol->language_specific.cplus_specific.demangled_name, and if not null, returns it. For Ada symbols, we expect this field to be not null (as a side question, I wonder why we even check this field when dealing with Ada symbols at all, but that's a separate question - I will ask Paul). The following comment that I added with the patch explains why: Unfortunately, there is a case that we have to watch out for: During the symbol table processing, when creating the minimal symbols, we don't know the language associated to each entry. As a result, symbol_find_demangled_name tries various non-Ada demanglers, and sometimes, a demangler accepts the symbol and returns an unexpected demangled form of our symbol name. This has consequences during the debugging info processing: This time, we do know the language, but since we have already found an entry in the demangled_name_hash using the linkage name, we use the demangled name stored in the hash instead of trying to recompute it. So we had to add an explicit guard for Ada languages inside symtab.c:symbol_set_names to make sure that Ada symbol do not unexpectedly get the demangled_name field set. 2008-01-08 Joel Brobecker <brobecker@adacore.com> * symtab.c (symbol_set_names): Do not set the demangled_name for Ada symbols. I also wrote a small testcase. 2008-01-08 Joel Brobecker <brobecker@adacore.com> * gdb.ada/sym_print_name: New test program. * gdb.ada/sym_print_name.exp: New testcase. Tested on x86-linux, no regression. OK to commit? 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] |