42 error (_(
"-symbol-list-lines: Usage: SOURCE_FILENAME"));
48 error (_(
"-symbol-list-lines: Unknown source file name."));
59 for (i = 0; i < s->
linetable ()->nitems; i++)
80 if (sym->
line () != 0)
117 const char *type_regexp,
bool exclude_minsyms,
124 std::vector<symbol_search> symbols = sym_search.
search ();
131 if (i < symbols.size () && symbols[i].msymbol.minsym ==
nullptr)
136 while (i < symbols.size () && symbols[i].msymbol.minsym ==
nullptr)
148 for (; (i < symbols.size ()
149 && symbols[i].msymbol.minsym ==
nullptr
150 && symbols[i].symbol->symtab () ==
symtab);
161 if (i < symbols.size ())
166 for (; i < symbols.size (); i++)
168 gdb_assert (symbols[i].msymbol.minsym !=
nullptr);
181 long long val = strtoll (arg, &ptr, 10);
182 if (arg == ptr || *ptr !=
'\0' || val >
SIZE_MAX || val < 0)
183 error (_(
"invalid value for --max-results argument"));
184 size_t max_results = (size_t) val;
194 const char *
const *argv,
int argc)
197 const char *regexp =
nullptr;
198 const char *t_regexp =
nullptr;
199 bool exclude_minsyms =
true;
203 INCLUDE_NONDEBUG_OPT, TYPE_REGEXP_OPT, NAME_REGEXP_OPT, MAX_RESULTS_OPT
205 static const struct mi_opt opts[] =
207 {
"-include-nondebug" , INCLUDE_NONDEBUG_OPT, 0},
208 {
"-type", TYPE_REGEXP_OPT, 1},
209 {
"-name", NAME_REGEXP_OPT, 1},
210 {
"-max-results", MAX_RESULTS_OPT, 1},
215 const char *oarg =
nullptr;
219 const char *cmd_string
221 ?
"-symbol-info-functions" :
"-symbol-info-variables");
222 int opt =
mi_getopt (cmd_string, argc, argv, opts, &oind, &oarg);
225 switch ((
enum opt) opt)
227 case INCLUDE_NONDEBUG_OPT:
228 exclude_minsyms =
false;
230 case TYPE_REGEXP_OPT:
233 case NAME_REGEXP_OPT:
236 case MAX_RESULTS_OPT:
242 mi_symbol_info (kind, regexp, t_regexp, exclude_minsyms, max_results);
246typedef std::vector<module_symbol_search>::const_iterator
262 const symbol *first_result_symbol = iter->second.
symbol;
275 && first_module_symbol == iter->first.
symbol
276 && first_symbtab == iter->second.symbol->symtab ());
293 gdb_assert (iter->first.symbol !=
nullptr);
294 gdb_assert (iter->second.symbol !=
nullptr);
308 while (iter != end && first_module_symbol == iter->first.
symbol)
320 const char *
const *argv,
int argc)
322 const char *module_regexp =
nullptr;
323 const char *regexp =
nullptr;
324 const char *type_regexp =
nullptr;
330 MODULE_REGEXP_OPT, TYPE_REGEXP_OPT, NAME_REGEXP_OPT
332 static const struct mi_opt opts[] =
334 {
"-module", MODULE_REGEXP_OPT, 1},
335 {
"-type", TYPE_REGEXP_OPT, 1},
336 {
"-name", NAME_REGEXP_OPT, 1},
341 const char *oarg =
nullptr;
345 const char *cmd_string
347 ?
"-symbol-info-module-functions"
348 :
"-symbol-info-module-variables");
349 int opt =
mi_getopt (cmd_string, argc, argv, opts, &oind, &oarg);
352 switch ((
enum opt) opt)
354 case MODULE_REGEXP_OPT:
355 module_regexp = oarg;
357 case TYPE_REGEXP_OPT:
360 case NAME_REGEXP_OPT:
366 std::vector<module_symbol_search> module_symbols
395 const char *
const *argv,
int argc)
404 const char *
const *argv,
int argc)
416 const char *regexp =
nullptr;
420 NAME_REGEXP_OPT, MAX_RESULTS_OPT
422 static const struct mi_opt opts[] =
424 {
"-name", NAME_REGEXP_OPT, 1},
425 {
"-max-results", MAX_RESULTS_OPT, 1},
430 const char *oarg =
nullptr;
434 int opt =
mi_getopt (
"-symbol-info-modules", argc, argv, opts,
438 switch ((
enum opt) opt)
440 case NAME_REGEXP_OPT:
443 case MAX_RESULTS_OPT:
459 const char *regexp =
nullptr;
463 NAME_REGEXP_OPT, MAX_RESULTS_OPT
465 static const struct mi_opt opts[] =
467 {
"-name", NAME_REGEXP_OPT, 1},
468 {
"-max-results", MAX_RESULTS_OPT, 1},
473 const char *oarg =
nullptr;
477 int opt =
mi_getopt (
"-symbol-info-types", argc, argv, opts,
481 switch ((
enum opt) opt)
483 case NAME_REGEXP_OPT:
486 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, const char *const *argv, const struct mi_opt *opts, int *oind, const 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)
std::vector< module_symbol_search >::const_iterator module_symbol_search_iterator
static void mi_info_functions_or_variables(enum search_domain kind, const char *const *argv, int argc)
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 mi_info_module_functions_or_variables(enum search_domain kind, const char *const *argv, int argc)
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)
static size_t parse_max_results_option(const char *arg)
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
CORE_ADDR pc(const struct objfile *objfile) const
struct linetable_entry item[1]
struct gdbarch * arch() const
struct type * type() const
unsigned int line() const
struct compunit_symtab * compunit() const
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)