47#include "gdbsupport/function-view.h"
48#include "gdbsupport/def-vector.h"
208 this->
result.symbols->push_back (*bsym);
222 this->
result.symbols->push_back (*bsym);
257const char *
const linespec_keywords[] = {
"if",
"thread",
"task",
"inferior",
"-force-condition", NULL };
258#define IF_KEYWORD_INDEX 0
259#define FORCE_KEYWORD_INDEX 4
279#define LS_TOKEN_STOKEN(TOK) (TOK).data.string
280#define LS_TOKEN_KEYWORD(TOK) (TOK).data.keyword
288 struct symtab *default_symtab,
304#define PARSER_STREAM(P) ((P)->lexer.stream)
315#define PARSER_STATE(PPTR) (&(PPTR)->state)
319#define PARSER_RESULT(PPTR) (&(PPTR)->result)
347#define PARSER_EXPLICIT(PPTR) (&PARSER_RESULT ((PPTR))->explicit_loc)
354 gdb::function_view<symbol_found_callback_ftype> callback);
370 const std::vector<block_symbol> &function_symbols,
371 std::vector<block_symbol> *label_funcs_ret,
372 const char *
name,
bool completion_mode =
false);
375 const std::vector<symtab *> &file_symtabs,
378 std::vector<block_symbol> *symbols,
379 std::vector<bound_minimal_symbol> *minsyms);
383 const char *variable);
386 int funfirstline,
struct symbol *sym);
398static std::vector<symtab *>
415 std::vector<symtab_and_line> *result);
501 if (!isspace (p[len]))
513 && isspace (p[nextlen]))
527 && isspace (p[nextlen]))
561 const char *p, *last;
564 while (p && *p !=
'\0' && *p !=
':')
577static gdb::unique_xmalloc_ptr<char>
588 return gdb::unique_xmalloc_ptr<char> (savestring (str, s - str));
598 p = skip_spaces ((
char *) p);
609 char end_char, start_char;
614 if (start_char ==
'(')
616 else if (start_char ==
'<')
625 if (*p == start_char)
627 else if (*p == end_char)
647 const char *
string,
size_t string_len)
649 const char *end =
string + string_len;
652 while (p >
string && *p !=
' ')
657 size_t len = end - p;
658 for (
size_t i = 0; keywords[i] != NULL; ++i)
659 if (strncmp (keywords[i], p, len) == 0)
685 && quote_char ==
'\"')
722 error (_(
"unmatched quote"));
830 while (
op > start && isspace (
op[-1]))
837 || !(isalnum (
op[-1]) ||
op[-1] ==
'_')))
933 case '0':
case '1':
case '2':
case '3':
case '4':
934 case '5':
case '6':
case '7':
case '8':
case '9':
951 case '\'':
case '\"':
1018 else if (advance_word)
1059 std::vector<symtab_and_line> *sals,
1061 const char *symname,
int literal_canonical)
1063 sals->push_back (*sal);
1073 if (!literal_canonical && sal->
symtab)
1080 if (symname != NULL && sal->
line != 0
1082 canonical->
suffix = xstrprintf (
"%s:%d", symname,
1083 sal->
line).release ();
1084 else if (symname != NULL)
1085 canonical->
suffix = xstrdup (symname);
1087 canonical->
suffix = xstrprintf (
"%d", sal->
line).release ();
1092 if (symname != NULL)
1093 canonical->
suffix = xstrdup (symname);
1095 canonical->
suffix = xstrdup (
"<unknown>");
1096 canonical->
symtab = NULL;
1109 hash = iterative_hash_object (aep->
pspace, 0);
1110 return iterative_hash_object (aep->
addr, hash);
1136 slot = htab_find_slot (set, &e, INSERT);
1160 gdb::function_view<symbol_found_callback_ftype> callback)
1164 if (search_pspace != NULL && search_pspace !=
pspace)
1196 (
block, lookup_name, name_domain,
1202 return callback (bsym);
1215static const struct block *
1229 domain_enum domain, gdb::function_view<symbol_found_callback_ftype> callback)
1245 std::vector<const char *> *result_names,
1246 std::vector<struct type *> *superclasses)
1249 const char *class_name = t->
name ();
1268 method_counter >= 0;
1273 if (symbol_name_compare (method_name, lookup_name, NULL))
1283 const char *phys_name;
1289 result_names->push_back (phys_name);
1306 const char *s = haystack;
1315 if (startswith (s, needle))
1323 while (s != NULL && *s !=
'\0');
1335 if (canonical->
symtab == NULL)
1336 return canonical->
suffix;
1347 std::vector<symtab_and_line> *result,
1348 const std::vector<const char *> &filters)
1350 for (
const char *
name : filters)
1354 for (
size_t j = 0; j < result->size (); ++j)
1361 if (
name == fullform)
1362 lsal.
sals.push_back ((*result)[j]);
1365 if (!lsal.
sals.empty ())
1379 std::vector<symtab_and_line> *result)
1384 lsal.
sals = std::move (*result);
1434 std::vector<symtab_and_line> *result,
1435 const char *select_mode)
1440 std::vector<const char *> filters;
1441 std::vector<struct decode_line_2_item> items;
1445 gdb_assert (!result->empty ());
1448 for (i = 0; i < result->size (); ++i)
1451 std::string displayform;
1454 gdb_assert (canonical->
suffix != NULL);
1458 if (canonical->
symtab == NULL)
1459 displayform = canonical->
suffix;
1462 const char *fn_for_display;
1465 displayform = string_printf (
"%s:%s", fn_for_display,
1469 items.emplace_back (std::move (fullform), std::move (displayform),
1477 items.erase (std::unique (items.begin (), items.end (),
1481 return a.fullform == b.fullform;
1486 error (_(
"canceled because the command is ambiguous\n"
1487 "See set/show multiple-symbol."));
1496 for (i = 0; i < items.size (); i++)
1499 prompt = getenv (
"PS2");
1508 if (args == 0 || *args == 0)
1517 error (_(
"canceled"));
1531 if (num >= items.size ())
1539 filters.push_back (item->
fullform.c_str ());
1560static void ATTRIBUTE_NORETURN
1569 throw_error (NOT_FOUND_ERROR,
1570 _(
"No symbol table is loaded. Use the \"file\" command."));
1579 throw_error (NOT_FOUND_ERROR,
1580 _(
"Undefined convenience variable or function \"%s\" "
1581 "not defined in \"%s\"."),
symbol, filename);
1583 throw_error (NOT_FOUND_ERROR,
1584 _(
"Undefined convenience variable or function \"%s\" "
1585 "not defined."),
symbol);
1590 throw_error (NOT_FOUND_ERROR,
1591 _(
"Function \"%s\" not defined in \"%s\"."),
1594 throw_error (NOT_FOUND_ERROR,
1595 _(
"Function \"%s\" not defined."),
symbol);
1602static void ATTRIBUTE_NORETURN
1606 static const char * token_type_strings[]
1607 = {
"keyword",
"colon",
"string",
"number",
"comma",
"end of input"};
1617 throw_error (GENERIC_ERROR,
1618 _(
"malformed linespec error: unexpected %s, \"%s\""),
1619 token_type_strings[
token.type],
string.get ());
1622 throw_error (GENERIC_ERROR,
1623 _(
"malformed linespec error: unexpected %s"),
1624 token_type_strings[
token.type]);
1629static void ATTRIBUTE_NORETURN
1632 if (function != NULL)
1633 throw_error (NOT_FOUND_ERROR,
1634 _(
"No label \"%s\" defined in function \"%s\"."),
1637 throw_error (NOT_FOUND_ERROR,
1638 _(
"No label \"%s\" defined in current function."),
1644static void ATTRIBUTE_NORETURN
1647 throw_error (NOT_FOUND_ERROR, _(
"No source file named %s."),
name);
1666 const char *start = string;
1674 else if (*
string ==
'-')
1682 if (*
string !=
'\0' && !isdigit (*
string))
1683 error (_(
"malformed line offset: \"%s\""), start);
1715 gdb::unique_xmalloc_ptr<char>
name;
1788 const char *source_filename
1813 std::vector<block_symbol> symbols;
1814 std::vector<bound_minimal_symbol> minimal_symbols;
1820 &symbols, &minimal_symbols);
1822 if (!symbols.empty () || !minimal_symbols.empty ())
1824 PARSER_RESULT (parser)->function_symbols = std::move (symbols);
1825 PARSER_RESULT (parser)->minimal_symbols = std::move (minimal_symbols);
1832 std::vector<block_symbol> labels
1836 if (!labels.empty ())
1838 PARSER_RESULT (parser)->labels.label_symbols = std::move (labels);
1840 = std::move (symbols);
1935 std::vector<block_symbol> symbols;
1939 std::vector<block_symbol> labels
1942 &symbols,
name.get ());
1944 if (!labels.empty ())
1947 = std::move (labels);
1949 = std::move (symbols);
2027static std::vector<symtab_and_line>
2031 int use_default = 0;
2077 std::vector<symtab_and_line> values;
2085 std::vector<symtab_and_line> intermediate_results
2087 if (intermediate_results.empty () && best_entry != NULL)
2102 gdb::def_vector<int> filter (intermediate_results.size ());
2103 gdb::def_vector<const block *> blocks (intermediate_results.size ());
2105 for (i = 0; i < intermediate_results.size (); ++i)
2111 intermediate_results[i].section);
2114 for (i = 0; i < intermediate_results.size (); ++i)
2116 if (blocks[i] != NULL)
2117 for (j = i + 1; j < intermediate_results.size (); ++j)
2119 if (blocks[j] == blocks[i])
2127 for (i = 0; i < intermediate_results.size (); ++i)
2130 struct symbol *sym = (blocks[i]
2131 ? blocks[i]->containing_function ()
2136 intermediate_results[i].symbol = sym;
2142 if (values.empty ())
2145 throw_error (NOT_FOUND_ERROR, _(
"No line %d in file \"%s\"."),
2148 throw_error (NOT_FOUND_ERROR, _(
"No line %d in the current file."),
2157static std::vector<symtab_and_line>
2167 std::vector<symtab_and_line> sals;
2175static std::vector<symtab_and_line>
2178 std::vector<symtab_and_line> sals;
2188 = sym.
symbol->symtab ()->compunit ()->objfile ()->pspace;
2193 sym.
symbol->natural_name (), 0);
2210 = sym.
symbol->symtab ()->compunit ()->objfile ()->pspace;
2217 bool found_ifunc =
false;
2223 const CORE_ADDR addr
2224 = sym.
symbol->value_block ()->entry_pc ();
2231 CORE_ADDR msym_addr = elem.value_address ();
2235 = elem.objfile->arch ();
2243 if (msym_addr == addr)
2258 sym.
symbol->natural_name (), 0);
2274 minsym_found (state, elem.objfile, elem.minsym, &sals);
2303 if (!sals.empty () && state->
canonical != NULL)
2316 const char *source_filename,
2317 const char *function_name,
2319 const char *label_name,
2322 std::vector<bound_minimal_symbol> minimal_symbols;
2326 if (source_filename != NULL)
2333 catch (
const gdb_exception_error &except)
2345 if (function_name != NULL)
2347 std::vector<block_symbol> symbols;
2350 function_name, fname_match_type,
2351 &symbols, &minimal_symbols);
2353 if (symbols.empty () && minimal_symbols.empty ())
2362 if (label_name != NULL)
2364 std::vector<block_symbol> symbols;
2365 std::vector<block_symbol> labels
2367 &symbols, label_name);
2369 if (labels.empty ())
2384static std::vector<symtab_and_line>
2450static std::vector<symtab_and_line>
2454 gdb_assert (arg !=
nullptr);
2456 struct gdb_exception file_exception;
2490 std::vector<symtab_and_line> values
2492 if (!values.empty ())
2501 if ((arg[0] ==
'-' || arg[0] ==
'+') && arg[1] ==
'\0')
2529 goto convert_to_sals;
2560 catch (gdb_exception_error &ex)
2562 file_exception = std::move (ex);
2565 if (file_exception.reason >= 0)
2609 if (file_exception.reason < 0)
2610 throw_exception (std::move (file_exception));
2649 struct symtab *default_symtab,
2653 memset (self, 0,
sizeof (*self));
2672 struct symtab *default_symtab,
2682 default_symtab, default_line, canonical);
2709 if (stringp == NULL || *stringp == NULL)
2734 const char *function,
2736 const char *source_filename)
2740 if (source_filename != NULL)
2743 function, function, source_filename);
2748 function, function);
2761 const char *source_filename)
2780 if (source_filename == NULL)
2793 char *fn = fn_list[0].release ();
2800 char quote_char_str[2] = { (char) tracker.
quote_char () };
2802 fn = reconcat (fn, fn, quote_char_str, (
char *) NULL);
2806 fn = reconcat (fn, fn,
":", (
char *) NULL);
2807 fn_list[0].reset (fn);
2823 const char *label_name)
2825 std::vector<block_symbol> label_function_symbols;
2826 std::vector<block_symbol> labels
2829 &label_function_symbols,
2832 for (
const auto &label : labels)
2834 char *match = xstrdup (label.symbol->search_name ());
2844 const char *source_filename,
2845 const char *function_name,
2847 const char *label_name)
2859 func_name_match_type,
2860 NULL, unknown_offset);
2862 catch (
const gdb_exception_error &ex)
2876 const char *orig = text;
2892 catch (
const gdb_exception_error &except)
2920 gdb::unique_xmalloc_ptr<char> text_copy
2933 std::vector<block_symbol> function_symbols;
2934 std::vector<bound_minimal_symbol> minimal_symbols;
2937 func_name, match_type,
2938 &function_symbols, &minimal_symbols);
2940 PARSER_RESULT (&parser)->function_symbols = std::move (function_symbols);
2941 PARSER_RESULT (&parser)->minimal_symbols = std::move (minimal_symbols);
3049 if (end > orig && end[-1] ==
' ')
3063static std::vector<symtab_and_line>
3067 std::vector<symtab_and_line> result;
3069 switch (locspec->
type ())
3083 const char *addr_string = addr_spec->
to_string ();
3086 if (addr_string != NULL)
3112 gdb_assert_not_reached (
"attempt to decode probe location");
3116 gdb_assert_not_reached (
"unhandled location spec type");
3127 struct symtab *default_symtab,
3129 const char *select_mode,
3132 std::vector<const char *> filters;
3138 gdb_assert (select_mode == NULL
3154 if (result.size () == 0)
3155 throw_error (NOT_SUPPORTED_ERROR, _(
"Location %s not available"),
3162 std::vector<gdb::unique_xmalloc_ptr<char>> hold_names;
3163 for (
int i = 0; i < result.size (); ++i)
3169 if (select_mode == NULL)
3181 filters.push_back (filter);
3193std::vector<symtab_and_line>
3210std::vector<symtab_and_line>
3214 error (_(
"Empty line specification."));
3222 std::vector<symtab_and_line> sals
3227 error (_(
"Junk at end of line specification: %s"),
string);
3234std::vector<symtab_and_line>
3238 error (_(
"Empty line specification."));
3242 std::vector<symtab_and_line> sals
3250 error (_(
"Junk at end of line specification: %s"),
string);
3271 *default_symtab = cursal.
symtab;
3272 *default_line = cursal.
line;
3287 throw_error (NOT_FOUND_ERROR, _(
"cannot evaluate expressions while "
3288 "program space is in startup"));
3303static std::vector<symtab_and_line>
3307 std::vector<const char *> symbol_names;
3308 const char *new_argptr;
3311 std::vector<symtab *> symtabs;
3312 symtabs.push_back (
nullptr);
3314 info.file_symtabs = &symtabs;
3316 std::vector<block_symbol>
symbols;
3317 info.result.symbols = &
symbols;
3321 new_argptr =
find_imps (arg, &symbol_names);
3322 if (symbol_names.empty ())
3328 std::vector<symtab_and_line> values;
3333 saved_arg = (
char *) alloca (new_argptr - arg + 1);
3334 memcpy (saved_arg, arg, new_argptr - arg);
3335 saved_arg[new_argptr - arg] =
'\0';
3351 holder = string_printf (
"%s:%s",
3354 str = holder.c_str ();
3372class decode_compound_collector
3375 decode_compound_collector ()
3376 : m_unique_syms (htab_create_alloc (1, htab_hash_pointer,
3377 htab_eq_pointer, NULL,
3383 std::vector<block_symbol> release_symbols ()
3385 return std::move (m_symbols);
3394 htab_up m_unique_syms;
3397 std::vector<block_symbol> m_symbols;
3401decode_compound_collector::operator () (
block_symbol *bsym)
3412 if (t->
code () != TYPE_CODE_STRUCT
3413 && t->
code () != TYPE_CODE_UNION
3414 && t->
code () != TYPE_CODE_NAMESPACE)
3417 slot = htab_find_slot (m_unique_syms.get (), sym, INSERT);
3421 m_symbols.push_back (*bsym);
3431static std::vector<block_symbol>
3433 const std::vector<symtab *> &file_symtabs,
3434 const char *class_name)
3436 decode_compound_collector collector;
3440 for (
const auto &elt : file_symtabs)
3446 NULL,
false, collector);
3449 NULL,
false, collector);
3455 program_space *pspace = elt->compunit ()->objfile ()->pspace;
3464 return collector.release_symbols ();
3484 uia = (uintptr_t) a.
symbol;
3485 uib = (uintptr_t) b.
symbol;
3508 uia = (uintptr_t) a.
minsym;
3509 uib = (uintptr_t) b.
minsym;
3525 const std::vector<const char *> &names,
3528 for (
const char *iter : names)
3537 std::vector<const char *> *result_names)
3539 size_t old_len = result_names->size ();
3543 std::vector<struct type *> new_supers;
3545 for (
type *t : superclasses)
3548 if (result_names->size () != old_len || new_supers.empty ())
3551 superclasses = std::move (new_supers);
3561 const std::vector<symtab *> &file_symtabs,
3562 const char *class_name,
const char *method_name,
3563 std::vector<block_symbol> *sym_classes,
3564 std::vector<block_symbol> *symbols,
3565 std::vector<bound_minimal_symbol> *minsyms)
3567 size_t last_result_len;
3568 std::vector<struct type *> superclass_vec;
3569 std::vector<const char *> result_names;
3574 std::sort (sym_classes->begin (), sym_classes->end (),
3579 info.result.symbols =
symbols;
3580 info.result.minimal_symbols = minsyms;
3591 last_result_len = 0;
3592 for (
const auto &elt : *sym_classes)
3597 unsigned int ix = &elt - &*sym_classes->begin ();
3606 method_name, &result_names, &superclass_vec);
3610 if (ix == sym_classes->size () - 1
3612 != (sym_classes->at (ix + 1).symbol->symtab ()
3613 ->compunit ()->objfile ()->pspace)))
3617 if (result_names.size () == last_result_len)
3627 superclass_vec.clear ();
3628 last_result_len = result_names.size ();
3632 if (!symbols->empty () || !minsyms->empty ())
3637 throw_error (NOT_FOUND_ERROR, _(
"see caller, this text doesn't matter"));
3647class symtab_collector
3651 : m_symtab_table (htab_create (1, htab_hash_pointer, htab_eq_pointer,
3657 bool operator () (
symtab *sym);
3660 std::vector<symtab *> &&release_symtabs ()
3662 return std::move (m_symtabs);
3667 std::vector<symtab *> m_symtabs;
3670 htab_up m_symtab_table;
3678 slot = htab_find_slot (m_symtab_table.get (),
symtab, INSERT);
3682 m_symtabs.push_back (
symtab);
3694static std::vector<symtab *>
3698 symtab_collector collector;
3701 if (search_pspace == NULL)
3705 if (pspace->executing_startup)
3718 return collector.release_symtabs ();
3724static std::vector<symtab *>
3728 std::vector<symtab *> result
3731 if (result.empty ())
3734 throw_error (NOT_FOUND_ERROR,
3735 _(
"No symbol table is loaded. "
3736 "Use the \"file\" command."));
3749 std::vector<symtab *> *search_symtabs,
3755 memset (&state, 0,
sizeof (state));
3757 info.state = &state;
3761 std::vector<symtab *> all_symtabs;
3762 if (search_symtabs ==
nullptr)
3764 all_symtabs.push_back (
nullptr);
3765 search_symtabs = &all_symtabs;
3767 info.file_symtabs = search_symtabs;
3779 const std::vector<symtab *> &file_symtabs,
const char *
name,
3781 std::vector<block_symbol> *symbols,
3782 std::vector<bound_minimal_symbol> *minsyms)
3785 std::vector<const char *> symbol_names;
3788 info.result.symbols =
symbols;
3789 info.result.minimal_symbols = minsyms;
3794 if (!symbol_names.empty ())
3808 const char *lookup_name,
3810 std::vector <block_symbol> *
symbols,
3811 std::vector<bound_minimal_symbol> *minsyms)
3813 gdb::unique_xmalloc_ptr<char> canon
3815 if (canon !=
nullptr)
3816 lookup_name = canon.get ();
3828 name_match_type,
symbols, minsyms);
3833 if (
symbols->empty () && minsyms->empty ())
3835 std::string klass, method;
3836 const char *last, *p, *scope_op;
3858 klass = std::string (lookup_name, last - lookup_name);
3861 last += strlen (scope_op);
3865 std::vector<block_symbol> classes
3867 if (!classes.empty ())
3873 klass.c_str (), method.c_str (),
3879 catch (
const gdb_exception_error &except)
3881 if (except.error != NOT_FOUND_ERROR)
3898 bool completion_mode,
3899 std::vector<block_symbol> *
result,
3900 std::vector<block_symbol> *label_funcs_ret)
3902 if (completion_mode)
3904 size_t name_len = strlen (
name);
3906 int (*cmp) (
const char *,
const char *, size_t);
3915 label_funcs_ret->push_back ({fn_sym,
block});
3924 if (label_sym.
symbol != NULL)
3926 result->push_back (label_sym);
3927 label_funcs_ret->push_back ({fn_sym,
block});
3940static std::vector<block_symbol>
3942 const std::vector<block_symbol> &function_symbols,
3943 std::vector<block_symbol> *label_funcs_ret,
3945 bool completion_mode)
3949 std::vector<block_symbol> result;
3951 if (function_symbols.empty ())
3967 &result, label_funcs_ret);
3971 for (
const auto &elt : function_symbols)
3979 &result, label_funcs_ret);
3990static std::vector<symtab_and_line>
3997 std::vector<symtab_and_line> values;
4002 gdb_assert (elt != NULL);
4004 program_space *pspace = elt->compunit ()->objfile ()->pspace;
4025static std::vector<symtab_and_line>
4031 std::vector<symtab_and_line> sals;
4034 std::vector<CORE_ADDR> pcs;
4037 gdb_assert (elt != NULL);
4039 program_space *pspace = elt->compunit ()->objfile ()->pspace;
4043 for (CORE_ADDR pc : pcs)
4051 sals.push_back (std::move (sal));
4069 p = (variable[1] ==
'$') ? variable + 2 : variable + 1;
4072 while (*p >=
'0' && *p <=
'9')
4077 struct value *val_history;
4079 sscanf ((variable[1] ==
'$') ? variable + 2 : variable + 1,
"%d", &index);
4082 if (val_history->
type ()->
code () != TYPE_CODE_INT)
4083 error (_(
"History values used in line "
4084 "specs must have integer values."));
4101 if (ivar !=
nullptr)
4106 error (_(
"Convenience variables used in line "
4107 "specs must have integer values."));
4128 std::vector<symtab_and_line> *result)
4130 bool want_start_sal =
false;
4132 CORE_ADDR func_addr;
4143 want_start_sal =
true;
4148 if (is_function && want_start_sal)
4175 std::vector<struct bound_minimal_symbol> *msyms)
4181 CORE_ADDR func_addr;
4195 msyms->emplace_back (minsym,
objfile);
4212 std::vector<struct bound_minimal_symbol> minsyms;
4218 if (search_pspace != NULL && search_pspace != pspace)
4220 if (pspace->executing_startup)
4231 info->state->list_mode,
4242 if (search_pspace == NULL || pspace == search_pspace)
4249 add_minsym (msym, symtab->compunit ()->objfile (), symtab,
4250 info->state->list_mode, &minsyms);
4281 if (&item2 == &item)
4286 if (msymbol_type_is_static (item2.minsym->type ()))
4289 if (strcmp (item.minsym->linkage_name (),
4290 item2.minsym->linkage_name ()) != 0)
4302 info->result.minimal_symbols->push_back (item);
4319 for (
const auto &elt : *info->file_symtabs)
4327 { return info->add_symbol (bsym); });
4330 else if (pspace == NULL || pspace == elt->compunit ()->objfile ()->pspace)
4332 int prev_len = info->result.symbols->size ();
4336 program_space *elt_pspace = elt->compunit ()->objfile ()->pspace;
4341 {
return info->add_symbol (bsym); });
4347 if (prev_len == info->result.symbols->size ()
4361 int funfirstline,
struct symbol *sym)
4381 else if (funfirstline)
4385 else if (sym->
line () != 0)
4404 xfree (lsal.canonical);
const struct ada_opname_map ada_opname_table[]
void * xcalloc(size_t number, size_t size)
const struct block * block_for_pc_sect(CORE_ADDR pc, struct obj_section *section)
iterator_range< block_iterator_wrapper > block_iterator_range
struct symbol * find_pc_sect_containing_function(CORE_ADDR pc, struct obj_section *section)
void discard_completions()
bool completes_to_completion_word(const char *word)
void add_completion(gdb::unique_xmalloc_ptr< char > name, completion_match_for_lcd *match_for_lcd=NULL, const char *text=NULL, const char *word=NULL)
bool have_completions() const
void set_quote_char(int quote_char)
void add_completions(completion_list &&list)
void advance_custom_word_point_by(int len)
void set_suppress_append_ws(bool suppress)
std::vector< block_symbol > m_symbols
void find_all_symbols(const std::string &name, const struct language_defn *language, enum search_domain search_domain, std::vector< symtab * > *search_symtabs, struct program_space *search_pspace)
std::vector< bound_minimal_symbol > m_minimal_symbols
void error_no_arg(const char *why)
void complete_on_enum(completion_tracker &tracker, const char *const *enumlist, const char *text, const char *word)
const char * remove_trailing_whitespace(const char *start, const char *s)
void complete_expression(completion_tracker &tracker, const char *text, const char *word)
const char * advance_to_expression_complete_word_point(completion_tracker &tracker, const char *text)
completion_list complete_source_filenames(const char *text)
std::vector< gdb::unique_xmalloc_ptr< char > > completion_list
int is_operator_name(const char *name)
const char * find_toplevel_char(const char *s, char c)
gdb::unique_xmalloc_ptr< char > cp_canonicalize_string_no_typedefs(const char *string)
const char * command_line_input(std::string &cmd_line_buffer, const char *, const char *)
struct value * parse_to_comma_and_eval(const char **expp)
const struct block * get_selected_block(CORE_ADDR *addr_in_block)
CORE_ADDR gdbarch_convert_from_func_ptr_addr(struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ)
struct type * check_typedef(struct type *type)
#define TYPE_FN_FIELD_PHYSNAME(thisfn, n)
#define TYPE_NFN_FIELDS(thistype)
#define TYPE_FN_FIELDLIST1(thistype, n)
#define TYPE_FN_FIELD_STUB(thisfn, n)
#define TYPE_BASECLASS(thistype, index)
#define TYPE_FN_FIELDLIST_LENGTH(thistype, n)
#define TYPE_FN_FIELDLIST_NAME(thistype, n)
#define TYPE_N_BASECLASSES(thistype)
mach_port_t kern_return_t mach_port_t mach_msg_type_name_t msgportsPoly mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
struct inferior * current_inferior(void)
struct interp * top_level_interpreter(void)
const struct language_defn * language_def(enum language lang)
const struct language_defn * current_language
static void find_method(struct linespec_state *self, const std::vector< symtab * > &file_symtabs, const char *class_name, const char *method_name, std::vector< block_symbol > *sym_classes, std::vector< block_symbol > *symbols, std::vector< bound_minimal_symbol > *minsyms)
static int eq_address_entry(const void *a, const void *b)
std::vector< symtab_and_line > decode_line_1(const location_spec *locspec, int flags, struct program_space *search_pspace, struct symtab *default_symtab, int default_line)
static void canonicalize_linespec(struct linespec_state *state, const linespec *ls)
static std::vector< symtab_and_line > decode_digits_ordinary(struct linespec_state *self, linespec *ls, int line, const linetable_entry **best_entry)
static void find_linespec_symbols(struct linespec_state *self, const std::vector< symtab * > &file_symtabs, const char *name, symbol_name_match_type name_match_type, std::vector< block_symbol > *symbols, std::vector< bound_minimal_symbol > *minsyms)
static std::vector< symtab * > collect_symtabs_from_filename(const char *file, struct program_space *pspace)
void decode_line_full(struct location_spec *locspec, int flags, struct program_space *search_pspace, struct symtab *default_symtab, int default_line, struct linespec_result *canonical, const char *select_mode, const char *filter)
static hashval_t hash_address_entry(const void *p)
static void decode_line_2(struct linespec_state *self, std::vector< symtab_and_line > *result, const char *select_mode)
static const char * skip_quote_char(const char *string, char quote_char)
static void add_sal_to_sals(struct linespec_state *self, std::vector< symtab_and_line > *sals, struct symtab_and_line *sal, const char *symname, int literal_canonical)
static void find_superclass_methods(std::vector< struct type * > &&superclasses, const char *name, enum language name_lang, std::vector< const char * > *result_names)
int is_ada_operator(const char *string)
static std::vector< symtab_and_line > decode_digits_list_mode(struct linespec_state *self, linespec *ls, struct symtab_and_line val)
static void initialize_defaults(struct symtab **default_symtab, int *default_line)
static int is_closing_quote_enclosed(const char *p)
static linespec_token save_stream_and_consume_token(linespec_parser *parser)
static struct line_offset linespec_parse_variable(struct linespec_state *self, const char *variable)
static bool compare_symbols(const block_symbol &a, const block_symbol &b)
static std::vector< symtab * > symtabs_from_filename(const char *, struct program_space *pspace)
static const struct block * get_current_search_block(void)
static void linespec_state_constructor(struct linespec_state *self, int flags, const struct language_defn *language, struct program_space *search_pspace, struct symtab *default_symtab, int default_line, struct linespec_result *canonical)
static int linespec_lexer_lex_number(linespec_parser *parser, linespec_token *tokenp)
static std::vector< symtab_and_line > decode_objc(struct linespec_state *self, linespec *ls, const char *arg)
static linespec_token linespec_lexer_lex_string(linespec_parser *parser)
#define PARSER_EXPLICIT(PPTR)
static const char * find_parameter_list_end(const char *input)
static gdb::unique_xmalloc_ptr< char > copy_token_string(linespec_token token)
static void add_all_symbol_names_from_pspace(struct collect_info *info, struct program_space *pspace, const std::vector< const char * > &names, enum search_domain search_domain)
static std::string canonical_to_fullform(const struct linespec_canonical_name *canonical)
static bool compare_msymbols(const bound_minimal_symbol &a, const bound_minimal_symbol &b)
static std::vector< symtab_and_line > create_sals_line_offset(struct linespec_state *self, linespec *ls)
static void ATTRIBUTE_NORETURN unexpected_linespec_error(linespec_parser *parser)
static void linespec_parse_basic(linespec_parser *parser)
static void linespec_state_destructor(struct linespec_state *self)
static void convert_explicit_location_spec_to_linespec(struct linespec_state *self, linespec *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)
static void find_methods(struct type *t, enum language t_lang, const char *name, std::vector< const char * > *result_names, std::vector< struct type * > *superclasses)
#define FORCE_KEYWORD_INDEX
static linespec_token linespec_lexer_peek_token(linespec_parser *parser)
std::vector< symtab_and_line > decode_line_with_current_source(const char *string, int flags)
static std::vector< block_symbol > lookup_prefix_sym(struct linespec_state *state, const std::vector< symtab * > &file_symtabs, const char *class_name)
const char *const linespec_keywords[]
static void ATTRIBUTE_NORETURN undefined_label_error(const char *function, const char *label)
static void ATTRIBUTE_NORETURN source_file_not_found_error(const char *name)
void linespec_lex_to_end(const char **stringp)
void linespec_complete_label(completion_tracker &tracker, 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)
static std::vector< symtab_and_line > parse_linespec(linespec_parser *parser, const char *arg, symbol_name_match_type match_type)
static const char linespec_quote_characters[]
const char * linespec_lexer_lex_keyword(const char *p)
#define PARSER_STATE(PPTR)
void linespec_complete(completion_tracker &tracker, const char *text, symbol_name_match_type match_type)
static void set_completion_after_number(linespec_parser *parser, linespec_complete_what next)
static std::vector< symtab_and_line > convert_linespec_to_sals(struct linespec_state *state, linespec *ls)
static int symbol_to_sal(struct symtab_and_line *result, int funfirstline, struct symbol *sym)
static std::vector< symtab_and_line > location_spec_to_sals(linespec_parser *parser, const location_spec *locspec)
static size_t string_find_incomplete_keyword_at_end(const char *const *keywords, const char *string, size_t string_len)
static bool decode_line_2_compare_items(const decode_line_2_item &a, const decode_line_2_item &b)
static std::vector< block_symbol > find_label_symbols(struct linespec_state *self, const std::vector< block_symbol > &function_symbols, std::vector< block_symbol > *label_funcs_ret, const char *name, bool completion_mode=false)
const char * get_gdb_linespec_parser_quote_characters(void)
static void iterate_over_file_blocks(struct symtab *symtab, const lookup_name_info &name, domain_enum domain, gdb::function_view< symbol_found_callback_ftype > callback)
static void add_matching_symbols_to_info(const char *name, symbol_name_match_type name_match_type, enum search_domain search_domain, struct collect_info *info, struct program_space *pspace)
static void ATTRIBUTE_NORETURN symbol_not_found_error(const char *symbol, const char *filename)
static void convert_results_to_lsals(struct linespec_state *self, std::vector< symtab_and_line > *result)
static void complete_linespec_component(linespec_parser *parser, completion_tracker &tracker, const char *text, linespec_complete_what component, const char *source_filename)
static std::vector< symtab_and_line > convert_explicit_location_spec_to_sals(struct linespec_state *self, linespec *result, const explicit_location_spec *explicit_spec)
static linespec_token linespec_lexer_lex_one(linespec_parser *parser)
CORE_ADDR linespec_expression_to_pc(const char **exp_ptr)
static void find_function_symbols(struct linespec_state *state, const std::vector< symtab * > &file_symtabs, const char *name, symbol_name_match_type name_match_type, std::vector< block_symbol > *symbols, std::vector< bound_minimal_symbol > *minsyms)
static int maybe_add_address(htab_t set, struct program_space *pspace, CORE_ADDR addr)
static void iterate_over_all_matching_symtabs(struct linespec_state *state, const lookup_name_info &lookup_name, const domain_enum name_domain, enum search_domain search_domain, struct program_space *search_pspace, bool include_inline, gdb::function_view< symbol_found_callback_ftype > callback)
static void minsym_found(struct linespec_state *self, struct objfile *objfile, struct minimal_symbol *msymbol, std::vector< symtab_and_line > *result)
static std::vector< symtab_and_line > convert_address_location_to_sals(struct linespec_state *self, CORE_ADDR address)
std::vector< symtab_and_line > decode_line_with_last_displayed(const char *string, int flags)
static void filter_results(struct linespec_state *self, std::vector< symtab_and_line > *result, const std::vector< const char * > &filters)
static void search_minsyms_for_name(struct collect_info *info, const lookup_name_info &name, struct program_space *search_pspace, struct symtab *symtab)
#define LS_TOKEN_KEYWORD(TOK)
void linespec_complete_function(completion_tracker &tracker, const char *function, symbol_name_match_type func_match_type, const char *source_filename)
static void add_minsym(struct minimal_symbol *minsym, struct objfile *objfile, struct symtab *symtab, int list_mode, std::vector< struct bound_minimal_symbol > *msyms)
#define LS_TOKEN_STOKEN(TOK)
struct line_offset linespec_parse_line_offset(const char *string)
#define PARSER_RESULT(PPTR)
static void find_label_symbols_in_block(const struct block *block, const char *name, struct symbol *fn_sym, bool completion_mode, std::vector< block_symbol > *result, std::vector< block_symbol > *label_funcs_ret)
static linespec_token linespec_lexer_consume_token(linespec_parser *parser)
static const char * find_toplevel_string(const char *haystack, const char *needle)
static void complete_label(completion_tracker &tracker, linespec_parser *parser, const char *label_name)
@ DECODE_LINE_FUNFIRSTLINE
const explicit_location_spec * as_explicit_location_spec(const location_spec *locspec)
const address_location_spec * as_address_location_spec(const location_spec *locspec)
const linespec_location_spec * as_linespec_location_spec(const location_spec *locspec)
location_spec_up string_to_location_spec(const char **stringp, const struct language_defn *language, symbol_name_match_type match_type)
location_spec_up new_linespec_location_spec(const char **linespec, symbol_name_match_type match_type)
std::unique_ptr< location_spec > location_spec_up
void iterate_over_minimal_symbols(struct objfile *objf, const lookup_name_info &lookup_name, gdb::function_view< bool(struct minimal_symbol *)> callback)
bool msymbol_is_function(struct objfile *objfile, minimal_symbol *minsym, CORE_ADDR *func_address_p)
const char * find_imps(const char *method, std::vector< const char * > *symbol_names)
int have_minimal_symbols(void)
int have_partial_symbols(void)
int have_full_symbols(void)
struct program_space * current_program_space
void set_current_program_space(struct program_space *pspace)
std::vector< struct program_space * > program_spaces
const char * symtab_to_fullname(struct symtab *s)
const char * symtab_to_filename_for_display(struct symtab *symtab)
struct symtab_and_line get_current_source_symtab_and_line(void)
void set_default_source_symtab_and_line(void)
struct symtab * get_last_displayed_symtab(void)
int get_last_displayed_line(void)
bool last_displayed_sal_is_valid(void)
struct program_space * pspace
const block * superblock() const
symbol * function() const
struct block * block(size_t i)
struct block * static_block()
struct minimal_symbol * minsym
const std::vector< symtab * > * file_symtabs
struct collect_info::@84 result
std::vector< block_symbol > * symbols
virtual bool add_symbol(block_symbol *bsym)
std::vector< bound_minimal_symbol > * minimal_symbols
struct linespec_state * state
struct blockvector * blockvector()
struct objfile * objfile() const
decode_line_2_item(std::string &&fullform_, std::string &&displayform_, bool selected_)
struct line_offset line_offset
symbol_name_match_type func_name_match_type
location_spec_up clone() const override
std::string to_linespec() const
const char * natural_name() const
const char * search_name() const
enum language language() const
struct obj_section * obj_section(const struct objfile *objfile) const
const char * linkage_name() const
enum language la_language
symbol_name_matcher_ftype * get_symbol_name_matcher(const lookup_name_info &lookup_name) const
virtual bool iterate_over_symbols(const struct block *block, const lookup_name_info &name, domain_enum domain, gdb::function_view< symbol_found_callback_ftype > callback) const
enum offset_relative_sign sign
symbol_name_match_type match_type
const char * completion_word
linespec_complete_what complete_what
const char * completion_quote_end
int completion_quote_char
linespec_parser(int flags, const struct language_defn *language, struct program_space *search_pspace, struct symtab *default_symtab, int default_line, struct linespec_result *canonical)
struct linespec_parser::@86 lexer
DISABLE_COPY_AND_ASSIGN(linespec_parser)
struct completion_tracker * completion_tracker
std::vector< linespec_sals > lsals
std::vector< symtab_and_line > sals
struct program_space * search_pspace
struct linespec_result * canonical
struct program_space * program_space
const struct language_defn * language
struct linespec_canonical_name * canonical_names
struct symtab * default_symtab
union linespec_token::@85 data
std::vector< block_symbol > function_symbols
explicit_location_spec explicit_loc
std::vector< symtab * > file_symtabs
struct linespec::@83 labels
std::vector< bound_minimal_symbol > minimal_symbols
std::vector< block_symbol > label_symbols
virtual location_spec_up clone() const =0
enum location_spec_type type() const
void set_string(std::string &&string)
const char * to_string() const
minimal_symbol_type type() const
CORE_ADDR value_address(objfile *objfile) const
struct program_space * pspace
bool expand_symtabs_matching(gdb::function_view< expand_symtabs_file_matcher_ftype > file_matcher, const lookup_name_info *lookup_name, gdb::function_view< expand_symtabs_symbol_matcher_ftype > symbol_matcher, gdb::function_view< expand_symtabs_exp_notify_ftype > expansion_notify, block_search_flags search_flags, domain_enum domain, enum search_domain kind)
compunit_symtab_range compunits()
objfiles_range objfiles()
bool add_symbol(block_symbol *bsym) override
const block * value_block() const
address_class aclass() const
struct type * type() const
unsigned int line() const
bool matches(domain_enum d) const
CORE_ADDR value_address() const
struct obj_section * section
struct program_space * pspace
struct minimal_symbol * msymbol
struct compunit_symtab * compunit() const
const char * name() const
struct type * type() const
struct obj_section * find_pc_overlay(CORE_ADDR pc)
const char multiple_symbols_all[]
struct block_symbol lookup_symbol(const char *name, const struct block *block, domain_enum domain, struct field_of_this_result *is_a_field_of_this)
const char multiple_symbols_ask[]
std::vector< CORE_ADDR > find_pcs_for_symtab_line(struct symtab *symtab, int line, const linetable_entry **best_item)
void iterate_over_symtabs(const char *name, gdb::function_view< bool(symtab *)> callback)
const char multiple_symbols_cancel[]
void collect_file_symbol_completion_matches(completion_tracker &tracker, complete_symbol_mode mode, symbol_name_match_type name_match_type, const char *text, const char *word, const char *srcfile)
void skip_prologue_sal(struct symtab_and_line *sal)
symtab_and_line find_function_start_sal(CORE_ADDR func_addr, obj_section *section, bool funfirstline)
struct symtab_and_line find_pc_sect_line(CORE_ADDR pc, struct obj_section *section, int notcurrent)
struct symtab * find_line_symtab(struct symtab *sym_tab, int line, int *index, bool *exact_match)
const char * multiple_symbols_select_mode(void)
void collect_symbol_completion_matches(completion_tracker &tracker, complete_symbol_mode mode, symbol_name_match_type name_match_type, const char *text, const char *word)
struct symtab_and_line find_pc_line(CORE_ADDR pc, int notcurrent)
#define gnu_ifunc_resolve_name
bool symbol_name_matcher_ftype(const char *symbol_search_name, const lookup_name_info &lookup_name, completion_match_result *comp_match_res)
void printf_unfiltered(const char *format,...)
CORE_ADDR value_as_address(struct value *val)
struct internalvar * lookup_only_internalvar(const char *name)
LONGEST value_as_long(struct value *val)
struct value * access_value_history(int num)
int get_internalvar_integer(struct internalvar *var, LONGEST *result)