aboutsummaryrefslogtreecommitdiff
path: root/gdb/linespec.c
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2011-08-18 16:17:39 +0000
committerKeith Seitz <keiths@redhat.com>2011-08-18 16:17:39 +0000
commit3a93a0c2ef1629add02bfdb6efe81015819acd35 (patch)
tree40d5b97e7a1d2698688510f6cb66c831daac5da2 /gdb/linespec.c
parent7230378dfd17300cd58e07acda312299f6bd1936 (diff)
downloadgdb-3a93a0c2ef1629add02bfdb6efe81015819acd35.zip
gdb-3a93a0c2ef1629add02bfdb6efe81015819acd35.tar.gz
gdb-3a93a0c2ef1629add02bfdb6efe81015819acd35.tar.bz2
PR c++/12266
* cp-name-parser.y (struct demangle_info): Remove unused member PREV. (d_grab): Likewise. (allocate_info): Change return type to struct demangle_info *. Always allocate a new demangle_info. Remove unused PREV pointer. (cp_new_demangle_parse_info): New function. (cp_demangled_name_parse_free): New function. (do_demangled_name_parse_free_cleanup): New function. (make_cleanup_cp_demangled_name_parse_free): New function. (cp_demangled_name_to_comp): Change return type to struct demangle_parse_info *. Allocate a new storage for each call. (main): Update usage for cp_demangled_name_to_comp API change. * cp-support.h (struct demangle_parse_info): New structure. (cp_demangled_name_to_comp): Update API change for return type. (cp_new_demangle_parse_info): Declare. (make_cleanup_cp_demangled_name_parse_free): New declaration. (cp_demangled_name_parse_free): Declare. * cp-support.c (cp_canonicalize_string): Update API change for cp_demangled_name_to_comp. (mangled_name_to_comp): Likewise. Return struct demangle_parse_info, too. (cp_class_name_from_physname): Update mangled_name_to_comp API change. (method_name_from_physname): Likewise. (cp_func_name): Update API change for cp_demangled_name_to_comp. (cp_remove_params): Likewise. * python/py-type.c (typy_legacy_template_argument): Likewise. * cp-support.h (cp_canonicalize_string_no_typedefs): Declare. (cp_merge_demangle_parse_infos): Declare. * cp-support.c (ignore_typedefs): New file global. (copy_string_to_obstack): New function. (inspect_type): New function. (replace_typedefs): New function. (replace_typedefs_qualified_name): New function. (cp_canonicalize_string_no_typedefs): New function. * cp-name-parser.y (cp_merge_demangle_parse_infos): New function. (cp_new_demangle__parse_info): Allocate and initialize the obstack. * linespec.c (find_methods): Use cp_canonicalize_string_no_typedefs instead of cp_canonicalize_string. (find_method): Likewise. (decode_compound): Before looking up the name, call cp_canonicalize_string_no_typedefs. (decode_variable): Likewise.
Diffstat (limited to 'gdb/linespec.c')
-rw-r--r--gdb/linespec.c43
1 files changed, 35 insertions, 8 deletions
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 137ef9c..b96c79f 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -245,7 +245,7 @@ find_methods (struct type *t, char *name, enum language language,
/* NAME is typed by the user: it needs to be canonicalized before
passing to lookup_symbol. */
- canon = cp_canonicalize_string (name);
+ canon = cp_canonicalize_string_no_typedefs (name);
if (canon != NULL)
{
name = canon;
@@ -1365,7 +1365,7 @@ decode_compound (char **argptr, int funfirstline,
char *the_real_saved_arg, char *p)
{
struct symtabs_and_lines values;
- char *p2;
+ char *p2, *name, *canon;
char *saved_arg2 = *argptr;
char *temp_end;
struct symbol *sym;
@@ -1373,6 +1373,7 @@ decode_compound (char **argptr, int funfirstline,
struct symbol *sym_class;
struct type *t;
char *saved_arg;
+ struct cleanup *cleanup;
/* If the user specified any completer quote characters in the input,
strip them. They are superfluous. */
@@ -1597,7 +1598,18 @@ decode_compound (char **argptr, int funfirstline,
*argptr = (*p == '\'') ? p + 1 : p;
/* Look up entire name. */
- sym = lookup_symbol (copy, get_selected_block (0), VAR_DOMAIN, 0);
+ name = copy;
+
+ cleanup = make_cleanup (null_cleanup, NULL);
+ canon = cp_canonicalize_string_no_typedefs (copy);
+ if (canon != NULL)
+ {
+ name = canon;
+ make_cleanup (xfree, name);
+ }
+
+ sym = lookup_symbol (name, get_selected_block (0), VAR_DOMAIN, 0);
+ do_cleanups (cleanup);
if (sym)
return symbol_found (funfirstline, canonical, copy, sym, NULL, NULL);
else
@@ -1743,7 +1755,7 @@ find_method (int funfirstline, struct linespec_result *canonical,
strcpy (name, SYMBOL_NATURAL_NAME (sym_class));
strcat (name, "::");
strcat (name, copy);
- canon = cp_canonicalize_string (name);
+ canon = cp_canonicalize_string_no_typedefs (name);
if (canon != NULL)
{
xfree (name);
@@ -2085,16 +2097,31 @@ decode_variable (char *copy, int funfirstline,
struct linespec_result *canonical,
struct symtab *file_symtab)
{
+ char *name, *canon;
struct symbol *sym;
+ struct cleanup *cleanup;
struct minimal_symbol *msymbol;
- sym = lookup_symbol (copy, get_search_block (file_symtab),
- VAR_DOMAIN, 0);
+ name = copy;
+ cleanup = make_cleanup (null_cleanup, NULL);
+ canon = cp_canonicalize_string_no_typedefs (copy);
+ if (canon != NULL)
+ {
+ name = canon;
+ make_cleanup (xfree, name);
+ }
+
+ sym = lookup_symbol (name, get_search_block (file_symtab), VAR_DOMAIN, 0);
if (sym != NULL)
- return symbol_found (funfirstline, canonical, copy, sym, file_symtab, NULL);
+ {
+ do_cleanups (cleanup);
+ return symbol_found (funfirstline, canonical, copy, sym,
+ file_symtab, NULL);
+ }
- msymbol = lookup_minimal_symbol (copy, NULL, NULL);
+ msymbol = lookup_minimal_symbol (name, NULL, NULL);
+ do_cleanups (cleanup);
if (msymbol != NULL)
return minsym_found (funfirstline, msymbol);