forked from Imagelibrary/binutils-gdb
Kill init_sal
Instead, make symtab_and_line initialize its members itself. Many symtab_and_line declarations are moved to where the object is initialized at the same time both for clarity and to avoid double initialization. A few functions, like e.g., find_frame_sal are adjusted to return the sal using normal function return instead of an output parameter likewise to avoid having to default-construct a sal and then immediately have the object overwritten. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ada-lang.c (is_known_support_routine): Move sal declaration to where it is initialized. * breakpoint.c (create_internal_breakpoint, init_catchpoint) (parse_breakpoint_sals, decode_static_tracepoint_spec) (clear_command, update_static_tracepoint): Remove init_sal references. Move declarations closer to initializations. * cli/cli-cmds.c (list_command): Move sal declarations closer to initializations. * elfread.c (elf_gnu_ifunc_resolver_stop): Remove init_sal references. Move sal declarations closer to initializations. * frame.c (find_frame_sal): Return a symtab_and_line via function return instead of output parameter. Remove init_sal references. * frame.h (find_frame_sal): Return a symtab_and_line via function return instead of output parameter. * guile/scm-frame.c (gdbscm_frame_sal): Adjust. * guile/scm-symtab.c (stscm_make_sal_smob): Use in-place new instead of memset. (gdbscm_find_pc_line): Remove init_sal reference. * infcall.c (call_function_by_hand_dummy): Remove init_sal references. Move declarations closer to initializations. * infcmd.c (set_step_frame): Update. Move declarations closer to initializations. (finish_backward): Remove init_sal references. Move declarations closer to initializations. * infrun.c (process_event_stop_test, handle_step_into_function) (insert_hp_step_resume_breakpoint_at_frame) (insert_step_resume_breakpoint_at_caller): Likewise. * linespec.c (create_sals_line_offset, decode_digits_ordinary) (symbol_to_sal): Likewise. * probe.c (parse_probes_in_pspace): Remove init_sal reference. * python/py-frame.c (frapy_find_sal): Move sal declaration closer to its initialization. * reverse.c (save_bookmark_command): Use new/delete. Remove init_sal references. Move declarations closer to initializations. * source.c (get_current_source_symtab_and_line): Remove brace initialization. (set_current_source_symtab_and_line): Now takes the sal by const reference. Remove brace initialization. (line_info): Remove init_sal reference. * source.h (set_current_source_symtab_and_line): Now takes a symtab_and_line via const reference. * stack.c (set_current_sal_from_frame): Adjust. (print_frame_info): Adjust. (get_last_displayed_sal): Return the sal via function return instead of via output parameter. Simplify. (frame_info): Adjust. * stack.h (get_last_displayed_sal): Return the sal via function return instead of via output parameter. * symtab.c (init_sal): Delete. (find_pc_sect_line): Remove init_sal references. Move declarations closer to initializations. (find_function_start_sal): Remove init_sal references. Move declarations closer to initializations. * symtab.h (struct symtab_and_line): In-class initialize all fields. * tracepoint.c (set_traceframe_context) (print_one_static_tracepoint_marker): Remove init_sal references. Move declarations closer to initializations. * tui/tui-disasm.c (tui_show_disassem_and_update_source): Adjust. * tui/tui-stack.c (tui_show_frame_info): Adjust. Move declarations closer to initializations. * tui/tui-winsource.c (tui_update_source_window_as_is): Remove init_sal references. Adjust.
This commit is contained in:
@@ -3358,16 +3358,12 @@ create_internal_breakpoint (struct gdbarch *gdbarch,
|
||||
CORE_ADDR address, enum bptype type,
|
||||
const struct breakpoint_ops *ops)
|
||||
{
|
||||
struct symtab_and_line sal;
|
||||
struct breakpoint *b;
|
||||
|
||||
init_sal (&sal); /* Initialize to zeroes. */
|
||||
|
||||
symtab_and_line sal;
|
||||
sal.pc = address;
|
||||
sal.section = find_pc_overlay (sal.pc);
|
||||
sal.pspace = current_program_space;
|
||||
|
||||
b = set_raw_breakpoint (gdbarch, sal, type, ops);
|
||||
breakpoint *b = set_raw_breakpoint (gdbarch, sal, type, ops);
|
||||
b->number = internal_breakpoint_number--;
|
||||
b->disposition = disp_donttouch;
|
||||
|
||||
@@ -8525,9 +8521,7 @@ init_catchpoint (struct breakpoint *b,
|
||||
const char *cond_string,
|
||||
const struct breakpoint_ops *ops)
|
||||
{
|
||||
struct symtab_and_line sal;
|
||||
|
||||
init_sal (&sal);
|
||||
symtab_and_line sal;
|
||||
sal.pspace = current_program_space;
|
||||
|
||||
init_raw_breakpoint (b, gdbarch, sal, bp_catchpoint, ops);
|
||||
@@ -9379,18 +9373,14 @@ parse_breakpoint_sals (const struct event_location *location,
|
||||
breakpoint address. */
|
||||
if (last_displayed_sal_is_valid ())
|
||||
{
|
||||
struct symtab_and_line sal;
|
||||
CORE_ADDR pc;
|
||||
|
||||
init_sal (&sal); /* Initialize to zeroes. */
|
||||
|
||||
/* Set sal's pspace, pc, symtab, and line to the values
|
||||
corresponding to the last call to print_frame_info.
|
||||
Be sure to reinitialize LINE with NOTCURRENT == 0
|
||||
as the breakpoint line number is inappropriate otherwise.
|
||||
find_pc_line would adjust PC, re-set it back. */
|
||||
get_last_displayed_sal (&sal);
|
||||
pc = sal.pc;
|
||||
symtab_and_line sal = get_last_displayed_sal ();
|
||||
CORE_ADDR pc = sal.pc;
|
||||
|
||||
sal = find_pc_line (pc, 0);
|
||||
|
||||
/* "break" without arguments is equivalent to "break *PC"
|
||||
@@ -9600,10 +9590,7 @@ decode_static_tracepoint_spec (const char **arg_p)
|
||||
|
||||
marker = VEC_index (static_tracepoint_marker_p, markers, i);
|
||||
|
||||
symtab_and_line sal;
|
||||
init_sal (&sal);
|
||||
|
||||
sal = find_pc_line (marker->address, 0);
|
||||
symtab_and_line sal = find_pc_line (marker->address, 0);
|
||||
sal.pc = marker->address;
|
||||
sals.push_back (sal);
|
||||
|
||||
@@ -11799,12 +11786,10 @@ clear_command (char *arg, int from_tty)
|
||||
}
|
||||
else
|
||||
{
|
||||
init_sal (&last_sal); /* Initialize to zeroes. */
|
||||
|
||||
/* Set sal's line, symtab, pc, and pspace to the values
|
||||
corresponding to the last call to print_frame_info. If the
|
||||
codepoint is not valid, this will set all the fields to 0. */
|
||||
get_last_displayed_sal (&last_sal);
|
||||
last_sal = get_last_displayed_sal ();
|
||||
if (last_sal.symtab == 0)
|
||||
error (_("No source file specified."));
|
||||
|
||||
@@ -13883,7 +13868,6 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
|
||||
|
||||
if (!VEC_empty(static_tracepoint_marker_p, markers))
|
||||
{
|
||||
struct symtab_and_line sal2;
|
||||
struct symbol *sym;
|
||||
struct static_tracepoint_marker *tpmarker;
|
||||
struct ui_out *uiout = current_uiout;
|
||||
@@ -13898,11 +13882,7 @@ update_static_tracepoint (struct breakpoint *b, struct symtab_and_line sal)
|
||||
"found at previous line number"),
|
||||
b->number, tp->static_trace_marker_id);
|
||||
|
||||
init_sal (&sal2);
|
||||
|
||||
sal2.pc = tpmarker->address;
|
||||
|
||||
sal2 = find_pc_line (tpmarker->address, 0);
|
||||
symtab_and_line sal2 = find_pc_line (tpmarker->address, 0);
|
||||
sym = find_pc_sect_function (tpmarker->address, NULL);
|
||||
uiout->text ("Now in ");
|
||||
if (sym)
|
||||
|
||||
Reference in New Issue
Block a user