41 error (_(
"-symbol-list-lines: Usage: SOURCE_FILENAME"));
47 error (_(
"-symbol-list-lines: Unknown source file name."));
57 for (i = 0; i < s->
linetable ()->nitems; i++)
77 if (sym->
line () != 0)
114 const char *type_regexp,
bool exclude_minsyms,
121 std::vector<symbol_search> symbols = sym_search.
search ();
128 if (i < symbols.size () && symbols[i].msymbol.minsym ==
nullptr)
133 while (i < symbols.size () && symbols[i].msymbol.minsym ==
nullptr)
145 for (; (i < symbols.size ()
146 && symbols[i].msymbol.minsym ==
nullptr
147 && symbols[i].symbol->symtab () ==
symtab);
158 if (i < symbols.size ())
163 for (; i < symbols.size (); i++)
165 gdb_assert (symbols[i].msymbol.minsym !=
nullptr);
178 long long val = strtoll (arg, &ptr, 10);
179 if (arg == ptr || *ptr !=
'\0' || val >
SIZE_MAX || val < 0)
180 error (_(
"invalid value for --max-results argument"));
181 size_t max_results = (size_t) val;
193 const char *regexp =
nullptr;
194 const char *t_regexp =
nullptr;
195 bool exclude_minsyms =
true;
199 INCLUDE_NONDEBUG_OPT, TYPE_REGEXP_OPT, NAME_REGEXP_OPT, MAX_RESULTS_OPT
201 static const struct mi_opt opts[] =
203 {
"-include-nondebug" , INCLUDE_NONDEBUG_OPT, 0},
204 {
"-type", TYPE_REGEXP_OPT, 1},
205 {
"-name", NAME_REGEXP_OPT, 1},
206 {
"-max-results", MAX_RESULTS_OPT, 1},
211 char *oarg =
nullptr;
215 const char *cmd_string
217 ?
"-symbol-info-functions" :
"-symbol-info-variables");
218 int opt =
mi_getopt (cmd_string, argc, argv, opts, &oind, &oarg);
221 switch ((
enum opt) opt)
223 case INCLUDE_NONDEBUG_OPT:
224 exclude_minsyms =
false;
226 case TYPE_REGEXP_OPT:
229 case NAME_REGEXP_OPT:
232 case MAX_RESULTS_OPT:
238 mi_symbol_info (kind, regexp, t_regexp, exclude_minsyms, max_results);
242typedef std::vector<module_symbol_search>::const_iterator
258 const symbol *first_result_symbol = iter->second.
symbol;
271 && first_module_symbol == iter->first.
symbol
272 && first_symbtab == iter->second.symbol->symtab ());
289 gdb_assert (iter->first.symbol !=
nullptr);
290 gdb_assert (iter->second.symbol !=
nullptr);
304 while (iter != end && first_module_symbol == iter->first.
symbol)
316 char **argv,
int argc)
318 const char *module_regexp =
nullptr;
319 const char *regexp =
nullptr;
320 const char *type_regexp =
nullptr;
326 MODULE_REGEXP_OPT, TYPE_REGEXP_OPT, NAME_REGEXP_OPT
328 static const struct mi_opt opts[] =
330 {
"-module", MODULE_REGEXP_OPT, 1},
331 {
"-type", TYPE_REGEXP_OPT, 1},
332 {
"-name", NAME_REGEXP_OPT, 1},
337 char *oarg =
nullptr;
341 const char *cmd_string
343 ?
"-symbol-info-module-functions"
344 :
"-symbol-info-module-variables");
345 int opt =
mi_getopt (cmd_string, argc, argv, opts, &oind, &oarg);
348 switch ((
enum opt) opt)
350 case MODULE_REGEXP_OPT:
351 module_regexp = oarg;
353 case TYPE_REGEXP_OPT:
356 case NAME_REGEXP_OPT:
362 std::vector<module_symbol_search> module_symbols
410 const char *regexp =
nullptr;
414 NAME_REGEXP_OPT, MAX_RESULTS_OPT
416 static const struct mi_opt opts[] =
418 {
"-name", NAME_REGEXP_OPT, 1},
419 {
"-max-results", MAX_RESULTS_OPT, 1},
424 char *oarg =
nullptr;
428 int opt =
mi_getopt (
"-symbol-info-modules", argc, argv, opts,
432 switch ((
enum opt) opt)
434 case NAME_REGEXP_OPT:
437 case MAX_RESULTS_OPT:
452 const char *regexp =
nullptr;
456 NAME_REGEXP_OPT, MAX_RESULTS_OPT
458 static const struct mi_opt opts[] =
460 {
"-name", NAME_REGEXP_OPT, 1},
461 {
"-max-results", MAX_RESULTS_OPT, 1},
466 char *oarg =
nullptr;
470 int opt =
mi_getopt (
"-symbol-info-types", argc, argv, opts,
474 switch ((
enum opt) opt)
476 case NAME_REGEXP_OPT:
479 case MAX_RESULTS_OPT:
std::vector< symbol_search > search() const
void set_exclude_minsyms(bool exclude_minsyms)
void set_max_search_results(size_t max_search_results)
void set_symbol_type_regexp(const char *regexp)
const std::string & string()
void field_core_addr(const char *fldname, struct gdbarch *gdbarch, CORE_ADDR address)
void field_string(const char *fldname, const char *string, const ui_file_style &style=ui_file_style())
void field_signed(const char *fldname, LONGEST value)
void field_unsigned(const char *fldname, ULONGEST value)
void end(ui_out_type type)
mi_cmd_argv_ftype mi_cmd_symbol_info_modules
mi_cmd_argv_ftype mi_cmd_symbol_list_lines
mi_cmd_argv_ftype mi_cmd_symbol_info_functions
mi_cmd_argv_ftype mi_cmd_symbol_info_variables
mi_cmd_argv_ftype mi_cmd_symbol_info_types
mi_cmd_argv_ftype mi_cmd_symbol_info_module_variables
mi_cmd_argv_ftype mi_cmd_symbol_info_module_functions
int mi_getopt(const char *prefix, int argc, char **argv, const struct mi_opt *opts, int *oind, char **oarg)
static void mi_symbol_info(enum search_domain kind, const char *name_regexp, const char *type_regexp, bool exclude_minsyms, size_t max_results)
static void mi_info_module_functions_or_variables(enum search_domain kind, char **argv, int argc)
static void mi_info_functions_or_variables(enum search_domain kind, char **argv, int argc)
static size_t parse_max_results_option(char *arg)
std::vector< module_symbol_search >::const_iterator module_symbol_search_iterator
static module_symbol_search_iterator output_module_symbols_in_single_module_and_file(struct ui_out *uiout, module_symbol_search_iterator iter, const module_symbol_search_iterator end, enum search_domain kind)
static module_symbol_search_iterator output_module_symbols_in_single_module(struct ui_out *uiout, module_symbol_search_iterator iter, const module_symbol_search_iterator end, enum search_domain kind)
static void output_debug_symbol(ui_out *uiout, enum search_domain kind, struct symbol *sym, int block)
static void output_nondebug_symbol(ui_out *uiout, const struct bound_minimal_symbol &msymbol)
const char * symtab_to_fullname(struct symtab *s)
const char * symtab_to_filename_for_display(struct symtab *symtab)
CORE_ADDR value_address() const
struct minimal_symbol * minsym
struct objfile * objfile() const
const char * print_name() const
struct linetable_entry item[1]
struct gdbarch * arch() const
struct type * type() const
unsigned short line() const
struct compunit_symtab * compunit() const
struct linetable * linetable() const
struct symtab * lookup_symtab(const char *name)
std::vector< module_symbol_search > search_module_symbols(const char *module_regexp, const char *regexp, const char *type_regexp, search_domain kind)
std::string symbol_to_info_string(struct symbol *sym, int block, enum search_domain kind)
void type_print(struct type *type, const char *varstring, struct ui_file *stream, int show)