diff options
author | David Carlton <carlton@bactrian.org> | 2003-01-29 01:23:20 +0000 |
---|---|---|
committer | David Carlton <carlton@bactrian.org> | 2003-01-29 01:23:20 +0000 |
commit | be431c34739ec12c2b1f8172e1d1fd16193db636 (patch) | |
tree | 7d93c0322c5dc58c44aab8f391369d0e9612263c | |
parent | 0fa1956a5be67f681c02552d1fcb56e9172999b6 (diff) | |
download | gdb-be431c34739ec12c2b1f8172e1d1fd16193db636.tar.gz |
2003-01-28 David Carlton <carlton@math.stanford.edu>
* valops.c (find_overload_match): Calculate func_name via
SYMBOL_CPLUS_DEMANGLED_NAME + remove_params.
* symtab.c (remove_params): Make extern.
* symtab.h: Add declaration for remove_params.
* symtab.c (overload_list_add_symbol): Change second arg to const
char *.
* valops.c (find_overload_match) Update call to
make_symbol_overload_list.
* symtab.h: Update declaration for make_symbol_overload_list.
* symtab.c (make_symbol_overload_list): Change arguments.
* valops.c (find_overload_match): Rename cleanups to old_cleanups;
handle freeing func_name via cleanups.
-rw-r--r-- | gdb/ChangeLog | 15 | ||||
-rw-r--r-- | gdb/symtab.c | 41 | ||||
-rw-r--r-- | gdb/symtab.h | 6 | ||||
-rw-r--r-- | gdb/valops.c | 20 |
4 files changed, 43 insertions, 39 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 682a91c155c..052f9a34364 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,18 @@ +2003-01-28 David Carlton <carlton@math.stanford.edu> + + * valops.c (find_overload_match): Calculate func_name via + SYMBOL_CPLUS_DEMANGLED_NAME + remove_params. + * symtab.c (remove_params): Make extern. + * symtab.h: Add declaration for remove_params. + * symtab.c (overload_list_add_symbol): Change second arg to const + char *. + * valops.c (find_overload_match) Update call to + make_symbol_overload_list. + * symtab.h: Update declaration for make_symbol_overload_list. + * symtab.c (make_symbol_overload_list): Change arguments. + * valops.c (find_overload_match): Rename cleanups to old_cleanups; + handle freeing func_name via cleanups. + 2003-01-27 David Carlton <carlton@math.stanford.edu> * objfiles.h: Add comments about objfile->msymbols being NULL. diff --git a/gdb/symtab.c b/gdb/symtab.c index 730e27085d1..3b83aeba4b7 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -164,7 +164,8 @@ static void print_msymbol_info (struct minimal_symbol *); static void symtab_symbol_info (char *, namespace_enum, int); -static void overload_list_add_symbol (struct symbol *sym, char *oload_name); +static void overload_list_add_symbol (struct symbol *sym, + const char *oload_name); void _initialize_symtab (void); @@ -3857,7 +3858,7 @@ in_prologue (CORE_ADDR pc, CORE_ADDR func_start) /* Begin overload resolution functions */ -static char * +char * remove_params (const char *demangled_name) { const char *argp; @@ -3910,7 +3911,7 @@ static struct symbol **sym_return_val; characters. If so, add it to the current completion list. */ static void -overload_list_add_symbol (struct symbol *sym, char *oload_name) +overload_list_add_symbol (struct symbol *sym, const char *oload_name) { int newsize; int i; @@ -3952,13 +3953,16 @@ overload_list_add_symbol (struct symbol *sym, char *oload_name) } /* Return a null-terminated list of pointers to function symbols that - * match name of the supplied symbol FSYM. - * This is used in finding all overloaded instances of a function name. - * This has been modified from make_symbol_completion_list. */ - + match name of the supplied symbol FSYM and that occur within the + namespace given by the initial substring of NAMESPACE_NAME of + length NAMESPACE_LEN. Apply using directives from BLOCK. This is + used in finding all overloaded instances of a function name. This + has been modified from make_symbol_completion_list. */ struct symbol ** -make_symbol_overload_list (struct symbol *fsym) +make_symbol_overload_list (const char *func_name, + const char *namespace_name, + int namespace_len, const struct block *block) { register struct symbol *sym; register struct symtab *s; @@ -3967,24 +3971,7 @@ make_symbol_overload_list (struct symbol *fsym) register struct block *b, *surrounding_static_block = 0; struct dict_iterator iter; /* The name we are completing on. */ - char *oload_name = NULL; - /* Length of name. */ - int oload_name_len = 0; - - /* Look for the symbol we are supposed to complete on. */ - - oload_name = remove_params (SYMBOL_DEMANGLED_NAME (fsym)); - if (!oload_name) - { - sym_return_val_size = 1; - sym_return_val = - (struct symbol **) xmalloc (2 * sizeof (struct symbol *)); - sym_return_val[0] = fsym; - sym_return_val[1] = NULL; - - return sym_return_val; - } - oload_name_len = strlen (oload_name); + const char *oload_name = func_name; sym_return_val_size = 100; sym_return_val_index = 0; @@ -4070,8 +4057,6 @@ make_symbol_overload_list (struct symbol *fsym) } } - xfree (oload_name); - return (sym_return_val); } diff --git a/gdb/symtab.h b/gdb/symtab.h index 11595cc82c2..8ae48300e9f 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1229,7 +1229,11 @@ extern char **make_symbol_completion_list (char *, char *); extern char **make_file_symbol_completion_list (char *, char *, char *); -extern struct symbol **make_symbol_overload_list (struct symbol *); +extern char *remove_params (const char *demangled_name); + +extern struct symbol **make_symbol_overload_list (const char *, + const char *, int, + const struct block *); extern char **make_source_files_completion_list (char *, char *); diff --git a/gdb/valops.c b/gdb/valops.c index 77d58fec750..4a6e3ac498b 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -2818,7 +2818,7 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method, int boffset; register int ix; int static_offset; - struct cleanup *cleanups = NULL; + struct cleanup *old_cleanups = NULL; const char *obj_type_name = NULL; char *func_name = NULL; @@ -2850,26 +2850,27 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method, else { int i = -1; - func_name = cplus_demangle (SYMBOL_NAME (fsym), DMGL_NO_OPTS); + func_name = remove_params (SYMBOL_CPLUS_DEMANGLED_NAME (fsym)); /* If the name is NULL this must be a C-style function. Just return the same symbol. */ - if (!func_name) + if (func_name == NULL) { *symp = fsym; return 0; } - oload_syms = make_symbol_overload_list (fsym); - cleanups = make_cleanup (xfree, oload_syms); + old_cleanups = make_cleanup (xfree, func_name); + oload_syms = make_symbol_overload_list (func_name, "", 0, current_block); + make_cleanup (xfree, oload_syms); while (oload_syms[++i]) num_fns++; if (!num_fns) error ("Couldn't find function %s", func_name); } - oload_champ = find_oload_champ(arg_types, nargs, method, num_fns, fns_ptr, - oload_syms, &oload_champ_bv); + oload_champ = find_oload_champ (arg_types, nargs, method, num_fns, fns_ptr, + oload_syms, &oload_champ_bv); /* NOTE: dan/2000-03-10: Seems to be a better idea to just pick one if they have the exact same goodness. This is because there is no @@ -2931,7 +2932,6 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method, else { *symp = oload_syms[oload_champ]; - xfree (func_name); } if (objp) @@ -2943,8 +2943,8 @@ find_overload_match (struct type **arg_types, int nargs, char *name, int method, } *objp = temp; } - if (cleanups != NULL) - do_cleanups (cleanups); + if (old_cleanups != NULL) + do_cleanups (old_cleanups); switch (match_quality) { |