[patch 0/3] Re: [RFA] c++/11734 revisited (and c++/12273)

Keith Seitz keiths@redhat.com
Tue Mar 1 22:00:00 GMT 2011


On 02/27/2011 01:16 PM, Jan Kratochvil wrote:
> On Thu, 24 Feb 2011 21:40:36 +0100, Keith Seitz wrote:
>
> This is still not fixed.  I quoted there the line:
>
>>> +      char *paren = strchr (p, '(');

My bad. I misread your test case. I *think* I've added an appropriate 
test and fixed this for good. Or at least I hope I did. :-D


To summarize the changes in this version:

- Added some more tests based on your input
- Added a new function to collect all this naming stuff that
   started appearing in decode_line_1 and decode_compound.
- Rewrote this naming stuff to remove a bunch of bad/unintended
   assumptions (strchr ('('), whitespace)

I'm sure that some cleanup could be done to this, but as far as I am 
concerned, since this is supposedly blocking the next release, I am not 
in favor of even bigger changes right now, cleanups or rewrites. It's 
just too risky at the moment.

> Maybe some - simplified
> 	while (isspace (*p)) p++;
> 	if (*p == '(')
> would be enough?  I did not try.

Yeah, I added something like that.

> This is also not fixed.  Reproducible by modifying the testcase:
> -	set method "${class}::foo ($ovld) const"
> +	set method "${class}::foo ($ovld)  const"
>
> The problem is the quoted code:
>
>>> +      /* Make sure we keep important kewords like "const" */
>>> +      if (strncmp (p, " const", 6) == 0)
>>> +	p += 6;

I've changed all this. This should now be fixed.

> Also I am suspicious on not checking that !isalnum (p[strlen ("const")]) - that
> there is a word break and isn't there something like:
> 	(gdb) break method(int) constvariablename

I've implemented a check for this case.

> Here isn't tested:
> 	set method "${class}::foo"

I've added this.

I've attached the next revision of this mega-linespec-fixing patch.
Keith

ChangeLog
2011-03-01  Keith Seitz  <keiths@redhat.com>

	* linespec.c (find_methods): Canonicalize NAME before looking
	up the symbol.
	(name_end): New function.
	(is_overloaded): New function.
	(keep_name_info): New function.
	(decode_line_1): Use keep_name_info.
	(decode_compound): Likewise.

	PR c++/12273
	* linespec.c (locate_first_half): Keep overload information, too.
	(decode_compound): Use a string to represent break characters
	to escape the loop.
	If P points to a break character, do not increment it.
	For C++ and Java, keep overload information and relevant keywords.
	If we cannot find a symbol, search the minimal symbols.

	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.
	Pass a valid block to lookup_symbol.
	(lookup_prefix_sym): Likewise.
	(find_method): Construct search name based on SYM_CLASS instead
	of SAVED_ARG.
	* 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
2011-03-01  Keith Seitz  <keiths@redhat.com>

	PR c++/12273
	* gdb.cp/cmpd-minsyms.exp: New test.
	* gdb.cp/cmpd-minsyms.cc: New file.

	PR c++/11734
	* gdb.cp/ovsrch.exp: New test.
	* gdb.cp/ovsrch.h: New file.
	* gdb.cp/ovsrch1.cc: New file.
	* gdb.cp/ovsrch2.cc: New file.
	* gdb.cp/ovsrch3.cc: New file.
	* gdb.cp/ovsrch4.cc: New file.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: big-linespec.patch
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20110301/8608c23b/attachment.ksh>


More information about the Gdb-patches mailing list