static void find_linespec_symbols (struct linespec_state *self,
VEC (symtab_ptr) *file_symtabs,
const char *name,
+ symbol_name_match_type name_match_type,
VEC (symbolp) **symbols,
VEC (bound_minimal_symbol_d) **minsyms);
completion_tracker tmp_tracker;
const char *source_filename
= PARSER_EXPLICIT (parser)->source_filename;
+ symbol_name_match_type match_type
+ = PARSER_EXPLICIT (parser)->func_name_match_type;
linespec_complete_function (tmp_tracker,
parser->completion_word,
+ match_type,
source_filename);
if (tmp_tracker.have_completions ())
/* Try looking it up as a function/method. */
find_linespec_symbols (PARSER_STATE (parser),
PARSER_RESULT (parser)->file_symtabs, name,
+ PARSER_EXPLICIT (parser)->func_name_match_type,
&symbols, &minimal_symbols);
if (symbols != NULL || minimal_symbols != NULL)
linespec_p result,
const char *source_filename,
const char *function_name,
+ symbol_name_match_type fname_match_type,
const char *label_name,
struct line_offset line_offset)
{
VEC (symbolp) *symbols, *labels;
VEC (bound_minimal_symbol_d) *minimal_symbols;
+ result->explicit_loc.func_name_match_type = fname_match_type;
+
if (source_filename != NULL)
{
TRY
if (function_name != NULL)
{
find_linespec_symbols (self, result->file_symtabs,
- function_name, &symbols,
- &minimal_symbols);
+ function_name, fname_match_type,
+ &symbols, &minimal_symbols);
if (symbols == NULL && minimal_symbols == NULL)
symbol_not_found_error (function_name,
convert_explicit_location_to_linespec (self, result,
explicit_loc->source_filename,
explicit_loc->function_name,
+ explicit_loc->func_name_match_type,
explicit_loc->label_name,
explicit_loc->line_offset);
return convert_linespec_to_sals (self, result);
if no file is validly specified. Callers must check that.
Also, the line number returned may be invalid. */
-/* Parse the linespec in ARG. */
+/* Parse the linespec in ARG. MATCH_TYPE indicates how function names
+ should be matched. */
static std::vector<symtab_and_line>
-parse_linespec (linespec_parser *parser, const char *arg)
+parse_linespec (linespec_parser *parser, const char *arg,
+ symbol_name_match_type match_type)
{
linespec_token token;
struct gdb_exception file_exception = exception_none;
parser->lexer.stream = arg;
parser->completion_word = arg;
parser->complete_what = linespec_complete_what::FUNCTION;
+ PARSER_EXPLICIT (parser)->func_name_match_type = match_type;
/* Initialize the default symtab and line offset. */
initialize_defaults (&PARSER_STATE (parser)->default_symtab,
memset (parser, 0, sizeof (linespec_parser));
parser->lexer.current.type = LSTOKEN_CONSUMED;
memset (PARSER_RESULT (parser), 0, sizeof (struct linespec));
+ PARSER_EXPLICIT (parser)->func_name_match_type
+ = symbol_name_match_type::WILD;
PARSER_EXPLICIT (parser)->line_offset.sign = LINE_OFFSET_UNKNOWN;
linespec_state_constructor (PARSER_STATE (parser), flags, language,
search_pspace,
void
linespec_complete_function (completion_tracker &tracker,
const char *function,
+ symbol_name_match_type func_match_type,
const char *source_filename)
{
complete_symbol_mode mode = complete_symbol_mode::LINESPEC;
- symbol_name_match_type func_match_type = symbol_name_match_type::WILD;
if (source_filename != NULL)
{
{
completion_list fn_list;
- linespec_complete_function (tracker, text, source_filename);
+ symbol_name_match_type match_type
+ = PARSER_EXPLICIT (parser)->func_name_match_type;
+ linespec_complete_function (tracker, text, match_type, source_filename);
if (source_filename == NULL)
{
/* Haven't seen a source component, like in "b
const struct language_defn *language,
const char *source_filename,
const char *function_name,
+ symbol_name_match_type func_name_match_type,
const char *label_name)
{
linespec_parser parser;
PARSER_RESULT (&parser),
source_filename,
function_name,
+ func_name_match_type,
NULL, unknown_offset);
}
CATCH (ex, RETURN_MASK_ERROR)
/* See description in linespec.h. */
void
-linespec_complete (completion_tracker &tracker, const char *text)
+linespec_complete (completion_tracker &tracker, const char *text,
+ symbol_name_match_type match_type)
{
linespec_parser parser;
struct cleanup *cleanup;
linespec_parser_new (&parser, 0, current_language, NULL, NULL, 0, NULL);
cleanup = make_cleanup (linespec_parser_delete, &parser);
parser.lexer.saved_arg = text;
+ PARSER_EXPLICIT (&parser)->func_name_match_type = match_type;
PARSER_STREAM (&parser) = text;
parser.completion_tracker = &tracker;
furthest completion point we managed to parse to. */
TRY
{
- parse_linespec (&parser, text);
+ parse_linespec (&parser, text, match_type);
}
CATCH (except, RETURN_MASK_ERROR)
{
VEC (bound_minimal_symbol_d) *minimal_symbols;
find_linespec_symbols (PARSER_STATE (&parser),
PARSER_RESULT (&parser)->file_symtabs,
- func_name,
+ func_name, match_type,
&function_symbols, &minimal_symbols);
PARSER_RESULT (&parser)->function_symbols = function_symbols;
PARSER_STATE (parser)->is_linespec = 1;
TRY
{
- result = parse_linespec (parser, get_linespec_location (location));
+ const linespec_location *ls = get_linespec_location (location);
+ result = parse_linespec (parser,
+ ls->spec_string, ls->match_type);
}
CATCH (except, RETURN_MASK_ERROR)
{
else
str = saved_arg;
- self->canonical->location = new_linespec_location (&str);
+ self->canonical->location
+ = new_linespec_location (&str, symbol_name_match_type::FULL);
}
}
static void
find_function_symbols (struct linespec_state *state,
VEC (symtab_ptr) *file_symtabs, const char *name,
+ symbol_name_match_type name_match_type,
VEC (symbolp) **symbols,
VEC (bound_minimal_symbol_d) **minsyms)
{
add_all_symbol_names_from_pspace (&info, state->search_pspace,
symbol_names, FUNCTIONS_DOMAIN);
else
- add_matching_symbols_to_info (name, symbol_name_match_type::WILD,
- FUNCTIONS_DOMAIN,
+ add_matching_symbols_to_info (name, name_match_type, FUNCTIONS_DOMAIN,
&info, state->search_pspace);
do_cleanups (cleanup);
find_linespec_symbols (struct linespec_state *state,
VEC (symtab_ptr) *file_symtabs,
const char *lookup_name,
+ symbol_name_match_type name_match_type,
VEC (symbolp) **symbols,
VEC (bound_minimal_symbol_d) **minsyms)
{
2) break class::method where method is in class (and not a baseclass) */
find_function_symbols (state, file_symtabs, lookup_name,
+ name_match_type,
symbols, minsyms);
/* If we were unable to locate a symbol of the same name, try dividing