37#include "gdbsupport/gdb_optional.h"
38#include "safe-ctype.h"
48 int skip_unavailable);
57 error (_(
"-enable-frame-filters: no arguments allowed"));
65 frame_filter_flags
flags,
68 int frame_low,
int frame_high)
75 frame_low, frame_high);
98 static const struct mi_opt opts[] =
100 {
"-no-frame-filters", NO_FRAME_FILTERS, 0},
109 int opt =
mi_getopt (
"-stack-list-frames", argc, argv,
113 switch ((
enum opt) opt)
115 case NO_FRAME_FILTERS:
123 if ((argc - oind != 0) && (argc - oind != 2))
124 error (_(
"-stack-list-frames: Usage: [--no-frame-filters] [FRAME_LOW FRAME_HIGH]"));
127 if (argc - oind == 2)
129 frame_low = atoi (argv[0 + oind]);
130 frame_high = atoi (argv[1 + oind]);
148 error (_(
"-stack-list-frames: Not enough frames in stack."));
155 int py_frame_low = frame_low;
160 if (py_frame_low == -1)
165 py_frame_low, frame_high);
175 fi && (i <= frame_high || frame_high == -1);
179 fi.prepare_reinflate ();
197 error (_(
"-stack-info-depth: Usage: [MAX_DEPTH]"));
200 frame_high = atoi (argv[0]);
207 fi && (i < frame_high || frame_high == -1);
226 int skip_unavailable = 0;
235 static const struct mi_opt opts[] =
237 {
"-no-frame-filters", NO_FRAME_FILTERS, 0},
238 {
"-skip-unavailable", SKIP_UNAVAILABLE, 0},
246 int opt =
mi_getopt (
"-stack-list-locals", argc - 1, argv,
251 switch ((
enum opt) opt)
253 case NO_FRAME_FILTERS:
256 case SKIP_UNAVAILABLE:
257 skip_unavailable = 1;
265 if (argc - oind != 1)
266 error (_(
"-stack-list-locals: Usage: [--no-frame-filters] "
267 "[--skip-unavailable] PRINT_VALUES"));
305 int skip_unavailable = 0;
312 static const struct mi_opt opts[] =
314 {
"-no-frame-filters", NO_FRAME_FILTERS, 0},
315 {
"-skip-unavailable", SKIP_UNAVAILABLE, 0},
327 switch ((
enum opt) opt)
329 case NO_FRAME_FILTERS:
332 case SKIP_UNAVAILABLE:
333 skip_unavailable = 1;
338 if (argc - oind != 1 && argc - oind != 3)
339 error (_(
"-stack-list-arguments: Usage: " \
340 "[--no-frame-filters] [--skip-unavailable] "
341 "PRINT_VALUES [FRAME_LOW FRAME_HIGH]"));
343 if (argc - oind == 3)
345 frame_low = atoi (argv[1 + oind]);
346 frame_high = atoi (argv[2 + oind]);
366 error (_(
"-stack-list-arguments: Not enough frames in stack."));
373 int py_frame_low = frame_low;
378 if (py_frame_low == -1)
383 py_frame_low, frame_high);
393 fi && (i <= frame_high || frame_high == -1);
418 int skip_unavailable = 0;
427 static const struct mi_opt opts[] =
429 {
"-no-frame-filters", NO_FRAME_FILTERS, 0},
430 {
"-skip-unavailable", SKIP_UNAVAILABLE, 0},
438 int opt =
mi_getopt (
"-stack-list-variables", argc - 1,
439 argv, opts, &oind, &oarg);
442 switch ((
enum opt) opt)
444 case NO_FRAME_FILTERS:
447 case SKIP_UNAVAILABLE:
448 skip_unavailable = 1;
456 if (argc - oind != 1)
457 error (_(
"-stack-list-variables: Usage: [--no-frame-filters] " \
458 "[--skip-unavailable] PRINT_VALUES"));
495 gdb_assert (!arg->
val || !arg->
error);
497 && arg->
error == NULL)
500 && (arg->
val != NULL || arg->
error != NULL)));
505 if (skip_unavailable && arg->
val != NULL
516 gdb::optional<ui_out_emit_tuple> tuple_emitter;
518 tuple_emitter.emplace (uiout,
nullptr);
540 stb.
printf (_(
"<error reading variable: %s>"), arg->
error.get ());
552 catch (
const gdb_exception_error &except)
554 stb.
printf (_(
"<error reading variable: %s>"),
577 const char *name_of_result;
585 name_of_result =
"locals";
588 name_of_result =
"args";
591 name_of_result =
"variables";
594 internal_error (
"unexpected what_to_list: %d", (
int) what);
644 gdb_assert (sym2 != NULL);
655 if (
type->
code () != TYPE_CODE_ARRAY
656 &&
type->
code () != TYPE_CODE_STRUCT
657 &&
type->
code () != TYPE_CODE_UNION)
699 gdb_assert (frame_exp != NULL);
759 if (argc == 0 || argc > 1)
760 error (_(
"-stack-select-frame: Usage: FRAME_SPEC"));
768 error (_(
"-stack-info-frame: No arguments allowed"));
#define ALL_BLOCK_SYMBOLS(block, iter, sym)
const struct block * get_frame_block(frame_info_ptr frame, CORE_ADDR *addr_in_block)
virtual void puts(const char *str)
void printf(const char *,...) ATTRIBUTE_PRINTF(2
void field_signed(const char *fldname, LONGEST value)
void field_stream(const char *fldname, string_file &stream, const ui_file_style &style=ui_file_style())
struct value * parse_and_eval(const char *exp)
enum ext_lang_bt_status apply_ext_lang_frame_filter(frame_info_ptr frame, frame_filter_flags flags, enum ext_lang_frame_args args_type, struct ui_out *out, int frame_low, int frame_high)
void select_frame(frame_info_ptr fi)
struct frame_id frame_id_build_wild(CORE_ADDR stack_addr)
frame_info_ptr get_selected_frame(const char *message)
frame_info_ptr get_current_frame(void)
frame_info_ptr create_new_frame(CORE_ADDR addr, CORE_ADDR pc)
struct frame_id get_frame_id(frame_info_ptr fi)
frame_info_ptr get_prev_frame(frame_info_ptr this_frame)
void print_frame_info(const frame_print_options &fp_opts, frame_info_ptr, int print_level, enum print_what print_what, int args, int set_current_sal)
void read_frame_arg(const frame_print_options &fp_opts, symbol *sym, frame_info_ptr frame, struct frame_arg *argp, struct frame_arg *entryargp)
const char print_entry_values_only[]
const char print_entry_values_no[]
frame_info_ptr find_relative_frame(frame_info_ptr, int *)
frame_print_options user_frame_print_options
void read_frame_local(struct symbol *sym, frame_info_ptr frame, struct frame_arg *argp)
struct type * check_typedef(struct type *type)
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
const struct language_defn * language_def(enum language lang)
static frame_info_ptr parse_frame_specification(const char *frame_exp)
static enum ext_lang_bt_status mi_apply_ext_lang_frame_filter(frame_info_ptr frame, frame_filter_flags flags, enum print_values print_values, struct ui_out *out, int frame_low, int frame_high)
static void list_args_or_locals(const frame_print_options &fp_opts, enum what_to_list what, enum print_values values, frame_info_ptr fi, int skip_unavailable)
static void list_arg_or_local(const struct frame_arg *arg, enum what_to_list what, enum print_values values, int skip_unavailable)
mi_cmd_argv_ftype mi_cmd_stack_info_frame
mi_cmd_argv_ftype mi_cmd_stack_list_variables
mi_cmd_argv_ftype mi_cmd_enable_frame_filters
mi_cmd_argv_ftype mi_cmd_stack_select_frame
mi_cmd_argv_ftype mi_cmd_stack_info_depth
mi_cmd_argv_ftype mi_cmd_stack_list_locals
mi_cmd_argv_ftype mi_cmd_stack_list_frames
mi_cmd_argv_ftype mi_cmd_stack_list_args
int mi_getopt_allow_unknown(const char *prefix, int argc, char **argv, const struct mi_opt *opts, int *oind, char **oarg)
int mi_getopt(const char *prefix, int argc, char **argv, const struct mi_opt *opts, int *oind, char **oarg)
enum print_values mi_parse_print_values(const char *name)
void print_value(value *val, const value_print_options &opts)
const block * superblock() const
symbol * function() const
gdb::unique_xmalloc_ptr< char > error
const char * print_name() const
const char * search_name() const
enum language language() const
address_class aclass() const
struct type * type() const
struct block_symbol lookup_symbol_search_name(const char *search_name, const struct block *block, domain_enum domain)
void type_print(struct type *type, const char *varstring, struct ui_file *stream, int show)
void get_no_prettyformat_print_options(struct value_print_options *opts)
int val_print_scalar_type_p(struct type *type)
void common_val_print(struct value *value, struct ui_file *stream, int recurse, const struct value_print_options *options, const struct language_defn *language)
int value_bytes_available(const struct value *value, LONGEST offset, LONGEST length)
struct type * value_type(const struct value *value)
LONGEST value_embedded_offset(const struct value *value)
CORE_ADDR value_as_address(struct value *val)
LONGEST value_as_long(struct value *val)
int value_entirely_unavailable(struct value *value)