On 12/09/2010 01:44 PM, Tom Tromey wrote: >>>>>> "Keith" == Keith Seitz writes: > I don't think this problem would affect psymtab.c. So, you could > probably still use pre-expansion if you think that is better. I don't think it really matters. This patch seems simple enough to understand, and it works. I prefer to err on the side of least invasive. I fear that pre-expansion might have unforeseen consequences. I don't really need another dwarf2_physname! :-) > Keith> It's such a nightmare, it would actually a primary reason to > Keith> rewrite linespec.c entirely. One of these days, I'll find the > Keith> time to do it. > > That will be a happy day. For us anyway ;-) Or for me, since I seem to keep ending up dealing with problems in decode_line_1/decode_compound! > The ChangeLog entry should mention the PR, so the commit will end up in > bugzilla. Yes, of course. I completely forgot. Fixed. > For overlapping copies you must use memmove. Fixed. > I guess the search language could be a parameter. I realize that at > some point we'll need to use current_language, and that symtab.c isn't > exactly clean in this regard. It doesn't seem too hard to avoid letting > the rot creep into this code, though. I've added this parameter and pushed the language setting up a level into symtab.c. > The return type of this function should be just "char *". > Otherwise you will need casts when freeing. Okay. > I don't know if you can use prepare_for_testing here, but > if not you can at least use clean_restart. I've switched to prepare_for_testing, as I mentioned in my follow-up to Jan's message. Revised patch attached. Keith ChangeLog 2010-12-14 Keith Seitz PR c++/11734 * linespec.c (decode_compound): Rename SAVED_ARG to THE_REAL_SAVED_ARG. Make a copy of THE_REAL_SAVED_ARG in SAVED_ARG and strip single-quotes. * psymtab.c (lookup_partial_symbol): Add language parameter. (lookup_symbol_aux_psymtabs): Likewise. Don't assume that the psymtab we found was the right one. Search for the desired symbol in the symtab to be certain. (psymtab_search_name): New function. (lookup_partial_symbol): Use psymtab_search_name. Add language parameter. (read_symtabs_for_function): Add language parameter and pass to lookup_partial_symbol. (find_symbol_file_from_partial): Likewise. * symfile.h (struct quick_symbol_functions): Add language parameter to lookup_symbol, expand_symtabs_for_function, and find_symbol_file. * cp-support.c (make_symbol_overload_list): Update above API changes. * symtab.c (lookup_symbol_aux_quick): Pass the current language to the quick symbol functions. (basic_lookup_transparent_type_quick): Likewise. (find_main_filename): Likewise. * dwarf2_read.c (dw2_lookup_symbol): Add langauge parameter. (dw2_expand_symtabs_for_function): Likewise. (dw2_find_symbol_file): Likewise. testsuite/ChangeLog 2010-12-14 Keith Seitz PR c++/11734 * gdb.cp/pr11734.exp: New test. * gdb.cp/pr11734.h: New file. * gdb.cp/pr11734-1.cc: New file. * gdb.cp/pr11734-2.cc: New file. * gdb.cp/pr11734-3.cc: New file. * gdb.cp/pr11734-4.cc: New file.