diff options
author | Tom Tromey <tom@tromey.com> | 2022-07-25 14:06:35 -0300 |
---|---|---|
committer | Bruno Larsen <blarsen@redhat.com> | 2022-10-10 11:57:10 +0200 |
commit | bd2b40ac129b167f1a709589dee9c009a04a6e21 (patch) | |
tree | 675eb8430a923c94353eca0ec2e7b56cfc1eae37 /gdb/stack.c | |
parent | ba380b3e5162e89c4c81a73f4fb9fcbbbbe75e24 (diff) | |
download | gdb-bd2b40ac129b167f1a709589dee9c009a04a6e21.zip gdb-bd2b40ac129b167f1a709589dee9c009a04a6e21.tar.gz gdb-bd2b40ac129b167f1a709589dee9c009a04a6e21.tar.bz2 |
Change GDB to use frame_info_ptr
This changes GDB to use frame_info_ptr instead of frame_info *
The substitution was done with multiple sequential `sed` commands:
sed 's/^struct frame_info;/class frame_info_ptr;/'
sed 's/struct frame_info \*/frame_info_ptr /g' - which left some
issues in a few files, that were manually fixed.
sed 's/\<frame_info \*/frame_info_ptr /g'
sed 's/frame_info_ptr $/frame_info_ptr/g' - used to remove whitespace
problems.
The changed files were then manually checked and some 'sed' changes
undone, some constructors and some gets were added, according to what
made sense, and what Tromey originally did
Co-Authored-By: Bruno Larsen <blarsen@redhat.com>
Approved-by: Tom Tomey <tom@tromey.com>
Diffstat (limited to 'gdb/stack.c')
-rw-r--r-- | gdb/stack.c | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/gdb/stack.c b/gdb/stack.c index 012aa5d..abdd6f3 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -215,18 +215,18 @@ static const gdb::option::option_def backtrace_command_option_defs[] = { /* Prototypes for local functions. */ -static void print_frame_local_vars (struct frame_info *frame, +static void print_frame_local_vars (frame_info_ptr frame, bool quiet, const char *regexp, const char *t_regexp, int num_tabs, struct ui_file *stream); static void print_frame (const frame_print_options &opts, - frame_info *frame, int print_level, + frame_info_ptr frame, int print_level, enum print_what print_what, int print_args, struct symtab_and_line sal); -static struct frame_info *find_frame_for_function (const char *); -static struct frame_info *find_frame_for_address (CORE_ADDR); +static frame_info_ptr find_frame_for_function (const char *); +static frame_info_ptr find_frame_for_address (CORE_ADDR); /* Zero means do things normally; we are interacting directly with the user. One means print the full filename and linenumber when a @@ -314,7 +314,7 @@ static last_displayed_symtab_info_type last_displayed_symtab_info; /* See stack.h. */ bool -frame_show_address (struct frame_info *frame, +frame_show_address (frame_info_ptr frame, struct symtab_and_line sal) { /* If there is a line number, but no PC, then there is no location @@ -337,7 +337,7 @@ frame_show_address (struct frame_info *frame, /* See frame.h. */ void -print_stack_frame_to_uiout (struct ui_out *uiout, struct frame_info *frame, +print_stack_frame_to_uiout (struct ui_out *uiout, frame_info_ptr frame, int print_level, enum print_what print_what, int set_current_sal) { @@ -353,7 +353,7 @@ print_stack_frame_to_uiout (struct ui_out *uiout, struct frame_info *frame, source line, the actual PC is printed at the beginning. */ void -print_stack_frame (struct frame_info *frame, int print_level, +print_stack_frame (frame_info_ptr frame, int print_level, enum print_what print_what, int set_current_sal) { @@ -381,7 +381,7 @@ print_stack_frame (struct frame_info *frame, int print_level, argument (not just the first nameless argument). */ static void -print_frame_nameless_args (struct frame_info *frame, long start, int num, +print_frame_nameless_args (frame_info_ptr frame, long start, int num, int first, struct ui_file *stream) { struct gdbarch *gdbarch = get_frame_arch (frame); @@ -503,7 +503,7 @@ print_frame_arg (const frame_print_options &fp_opts, exception. */ void -read_frame_local (struct symbol *sym, struct frame_info *frame, +read_frame_local (struct symbol *sym, frame_info_ptr frame, struct frame_arg *argp) { argp->sym = sym; @@ -525,7 +525,7 @@ read_frame_local (struct symbol *sym, struct frame_info *frame, void read_frame_arg (const frame_print_options &fp_opts, - symbol *sym, frame_info *frame, + symbol *sym, frame_info_ptr frame, struct frame_arg *argp, struct frame_arg *entryargp) { struct value *val = NULL, *entryval = NULL; @@ -722,7 +722,7 @@ read_frame_arg (const frame_print_options &fp_opts, static void print_frame_args (const frame_print_options &fp_opts, - struct symbol *func, struct frame_info *frame, + struct symbol *func, frame_info_ptr frame, int num, struct ui_file *stream) { struct ui_out *uiout = current_uiout; @@ -929,7 +929,7 @@ print_frame_args (const frame_print_options &fp_opts, line is in the center of the next 'list'. */ void -set_current_sal_from_frame (struct frame_info *frame) +set_current_sal_from_frame (frame_info_ptr frame) { symtab_and_line sal = find_frame_sal (frame); if (sal.symtab != NULL) @@ -996,7 +996,7 @@ print_frame_info_to_print_what (const char *print_frame_info) /* Print the PC from FRAME, plus any flags, to UIOUT. */ static void -print_pc (struct ui_out *uiout, struct gdbarch *gdbarch, frame_info *frame, +print_pc (struct ui_out *uiout, struct gdbarch *gdbarch, frame_info_ptr frame, CORE_ADDR pc) { uiout->field_core_addr ("addr", gdbarch, pc); @@ -1031,7 +1031,7 @@ get_user_print_what_frame_info (gdb::optional<enum print_what> *what) void print_frame_info (const frame_print_options &fp_opts, - frame_info *frame, int print_level, + frame_info_ptr frame, int print_level, enum print_what print_what, int print_args, int set_current_sal) { @@ -1265,7 +1265,7 @@ get_last_displayed_sal () corresponding to FRAME. */ gdb::unique_xmalloc_ptr<char> -find_frame_funname (struct frame_info *frame, enum language *funlang, +find_frame_funname (frame_info_ptr frame, enum language *funlang, struct symbol **funcp) { struct symbol *func; @@ -1319,7 +1319,7 @@ find_frame_funname (struct frame_info *frame, enum language *funlang, static void print_frame (const frame_print_options &fp_opts, - frame_info *frame, int print_level, + frame_info_ptr frame, int print_level, enum print_what print_what, int print_args, struct symtab_and_line sal) { @@ -1474,11 +1474,11 @@ frame_selection_by_function_completer (struct cmd_list_element *ignore, level 1') then SELECTED_FRAME_P will be false. */ static void -info_frame_command_core (struct frame_info *fi, bool selected_frame_p) +info_frame_command_core (frame_info_ptr fi, bool selected_frame_p) { struct symbol *func; struct symtab *s; - struct frame_info *calling_frame_info; + frame_info_ptr calling_frame_info; int numregs; const char *funname = 0; enum language funlang = language_unknown; @@ -1780,10 +1780,10 @@ info_frame_command_core (struct frame_info *fi, bool selected_frame_p) /* Return the innermost frame at level LEVEL. */ -static struct frame_info * +static frame_info_ptr leading_innermost_frame (int level) { - struct frame_info *leading; + frame_info_ptr leading; leading = get_current_frame (); @@ -1801,11 +1801,11 @@ leading_innermost_frame (int level) /* Return the starting frame needed to handle COUNT outermost frames. */ -static struct frame_info * +static frame_info_ptr trailing_outermost_frame (int count) { - struct frame_info *current; - struct frame_info *trailing; + frame_info_ptr current; + frame_info_ptr trailing; trailing = get_current_frame (); @@ -1834,9 +1834,9 @@ trailing_outermost_frame (int count) SELECT_FRAME. */ static void -select_frame_command_core (struct frame_info *fi, bool ignored) +select_frame_command_core (frame_info_ptr fi, bool ignored) { - frame_info *prev_frame = get_selected_frame (); + frame_info_ptr prev_frame = get_selected_frame (); select_frame (fi); if (get_selected_frame () != prev_frame) gdb::observers::user_selected_context_changed.notify (USER_SELECTED_FRAME); @@ -1847,9 +1847,9 @@ select_frame_command_core (struct frame_info *fi, bool ignored) reprint the current frame summary). */ static void -frame_command_core (struct frame_info *fi, bool ignored) +frame_command_core (frame_info_ptr fi, bool ignored) { - frame_info *prev_frame = get_selected_frame (); + frame_info_ptr prev_frame = get_selected_frame (); select_frame (fi); if (get_selected_frame () != prev_frame) gdb::observers::user_selected_context_changed.notify (USER_SELECTED_FRAME); @@ -1871,7 +1871,7 @@ frame_command_core (struct frame_info *fi, bool ignored) 'frame' will all cause SELECTED_FRAME_P to be true. In all other cases SELECTED_FRAME_P is false. */ -template <void (*FPTR) (struct frame_info *fi, bool selected_frame_p)> +template <void (*FPTR) (frame_info_ptr fi, bool selected_frame_p)> class frame_command_helper { public: @@ -1882,7 +1882,7 @@ public: level (const char *arg, int from_tty) { int level = value_as_long (parse_and_eval (arg)); - struct frame_info *fid + frame_info_ptr fid = find_relative_frame (get_current_frame (), &level); if (level != 0) error (_("No frame at level %s."), arg); @@ -1897,7 +1897,7 @@ public: address (const char *arg, int from_tty) { CORE_ADDR addr = value_as_address (parse_and_eval (arg)); - struct frame_info *fid = find_frame_for_address (addr); + frame_info_ptr fid = find_frame_for_address (addr); if (fid == NULL) error (_("No frame at address %s."), arg); FPTR (fid, false); @@ -1910,7 +1910,7 @@ public: static void view (const char *args, int from_tty) { - struct frame_info *fid; + frame_info_ptr fid; if (args == NULL) error (_("Missing address argument to view a frame")); @@ -1942,7 +1942,7 @@ public: { if (arg == NULL) error (_("Missing function name argument")); - struct frame_info *fid = find_frame_for_function (arg); + frame_info_ptr fid = find_frame_for_function (arg); if (fid == NULL) error (_("No frame for function \"%s\"."), arg); FPTR (fid, false); @@ -1981,7 +1981,7 @@ backtrace_command_1 (const frame_print_options &fp_opts, const char *count_exp, int from_tty) { - struct frame_info *fi; + frame_info_ptr fi; int count; int py_start = 0, py_end = 0; enum ext_lang_bt_status result = EXT_LANG_BT_ERROR; @@ -2043,7 +2043,7 @@ backtrace_command_1 (const frame_print_options &fp_opts, "-no-filters" has been specified from the command. */ if (bt_opts.no_filters || result == EXT_LANG_BT_NO_FILTERS) { - struct frame_info *trailing; + frame_info_ptr trailing; /* The following code must do two things. First, it must set the variable TRAILING to the frame from which we should start @@ -2301,7 +2301,7 @@ void print_variable_and_value_data::operator() (const char *print_name, struct symbol *sym) { - struct frame_info *frame; + frame_info_ptr frame; if (preg.has_value () && preg->exec (sym->natural_name (), 0, NULL, 0) != 0) @@ -2355,7 +2355,7 @@ prepare_reg (const char *regexp, gdb::optional<compiled_regex> *reg) This function will invalidate FRAME. */ static void -print_frame_local_vars (struct frame_info *frame, +print_frame_local_vars (frame_info_ptr frame, bool quiet, const char *regexp, const char *t_regexp, int num_tabs, struct ui_file *stream) @@ -2521,7 +2521,7 @@ iterate_over_block_arg_vars (const struct block *b, This function will invalidate FRAME. */ static void -print_frame_arg_vars (struct frame_info *frame, +print_frame_arg_vars (frame_info_ptr frame, bool quiet, const char *regexp, const char *t_regexp, struct ui_file *stream) @@ -2613,14 +2613,14 @@ get_selected_block (CORE_ADDR *addr_in_block) but the final value of *LEVEL_OFFSET_PTR is nonzero and indicates how much farther the original request asked to go. */ -struct frame_info * -find_relative_frame (struct frame_info *frame, int *level_offset_ptr) +frame_info_ptr +find_relative_frame (frame_info_ptr frame, int *level_offset_ptr) { /* Going up is simple: just call get_prev_frame enough times or until the initial frame is reached. */ while (*level_offset_ptr > 0) { - struct frame_info *prev = get_prev_frame (frame); + frame_info_ptr prev = get_prev_frame (frame); if (!prev) break; @@ -2631,7 +2631,7 @@ find_relative_frame (struct frame_info *frame, int *level_offset_ptr) /* Going down is just as simple. */ while (*level_offset_ptr < 0) { - struct frame_info *next = get_next_frame (frame); + frame_info_ptr next = get_next_frame (frame); if (!next) break; @@ -2648,7 +2648,7 @@ find_relative_frame (struct frame_info *frame, int *level_offset_ptr) static void up_silently_base (const char *count_exp) { - struct frame_info *frame; + frame_info_ptr frame; int count = 1; if (count_exp) @@ -2679,7 +2679,7 @@ up_command (const char *count_exp, int from_tty) static void down_silently_base (const char *count_exp) { - struct frame_info *frame; + frame_info_ptr frame; int count = -1; if (count_exp) @@ -2717,7 +2717,7 @@ return_command (const char *retval_exp, int from_tty) { /* Initialize it just to avoid a GCC false warning. */ enum return_value_convention rv_conv = RETURN_VALUE_STRUCT_CONVENTION; - struct frame_info *thisframe; + frame_info_ptr thisframe; struct gdbarch *gdbarch; struct symbol *thisfun; struct value *return_value = NULL; @@ -2854,7 +2854,7 @@ return_command (const char *retval_exp, int from_tty) /* Find the most inner frame in the current stack for a function called FUNCTION_NAME. If no matching frame is found return NULL. */ -static struct frame_info * +static frame_info_ptr find_frame_for_function (const char *function_name) { /* Used to hold the lower and upper addresses for each of the @@ -2863,7 +2863,7 @@ find_frame_for_function (const char *function_name) { CORE_ADDR low, high; }; - struct frame_info *frame; + frame_info_ptr frame; bool found = false; int level = 1; @@ -2966,7 +2966,7 @@ make_frame_apply_options_def_group (qcs_flags *flags, static void frame_apply_command_count (const char *which_command, const char *cmd, int from_tty, - struct frame_info *trailing, int count) + frame_info_ptr trailing, int count) { qcs_flags flags; set_backtrace_options set_bt_opts = user_set_backtrace_options; @@ -2991,7 +2991,7 @@ frame_apply_command_count (const char *which_command, scoped_restore restore_set_backtrace_options = make_scoped_restore (&user_set_backtrace_options, set_bt_opts); - for (frame_info *fi = trailing; fi && count--; fi = get_prev_frame (fi)) + for (frame_info_ptr fi = trailing; fi && count--; fi = get_prev_frame (fi)) { QUIT; @@ -3198,7 +3198,7 @@ static void frame_apply_command (const char* cmd, int from_tty) { int count; - struct frame_info *trailing; + frame_info_ptr trailing; if (!target_has_stack ()) error (_("No stack.")); @@ -3236,11 +3236,11 @@ faas_command (const char *cmd, int from_tty) /* Find inner-mode frame with frame address ADDRESS. Return NULL if no matching frame can be found. */ -static struct frame_info * +static frame_info_ptr find_frame_for_address (CORE_ADDR address) { struct frame_id id; - struct frame_info *fid; + frame_info_ptr fid; id = frame_id_build_wild (address); @@ -3254,7 +3254,7 @@ find_frame_for_address (CORE_ADDR address) { if (id == get_frame_id (fid)) { - struct frame_info *prev_frame; + frame_info_ptr prev_frame; while (1) { |