forked from Imagelibrary/binutils-gdb
Introduce event_location_up
This removes make_cleanup_delete_event_location and instead changes the various location functions to return an event_location_up, a new unique_ptr typedef. This is largely straightforward, but be sure to examine the init_breakpoint_sal change. I believe the code I deleted there is dead, because "location != NULL" can never be true in that branch; but you should double-check. gdb/ChangeLog 2017-04-12 Tom Tromey <tom@tromey.com> * tracepoint.c (scope_info): Update. * spu-tdep.c (spu_catch_start): Update. * python/python.c (gdbpy_decode_line): Update. * python/py-finishbreakpoint.c (bpfinishpy_init): Update. * python/py-breakpoint.c (bppy_init): Update. * probe.c (parse_probes): Update. * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Update. * location.h (event_location_deleter): New struct. (event_location_up): New typedef. (new_linespec_location, new_address_location, new_probe_location) (new_explicit_location, copy_event_location) (string_to_event_location, string_to_event_location_basic) (string_to_explicit_location): Update return type. (make_cleanup_delete_event_location): Remove. * location.c (new_linespec_location, new_address_location) (new_probe_location, new_explicit_location, copy_event_location): Return event_location_up. (delete_event_location_cleanup) (make_cleanup_delete_event_location): Remove. (string_to_explicit_location, string_to_event_location_basic) (string_to_event_location): Return event_location_up. * linespec.c (canonicalize_linespec, event_location_to_sals) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc): Update. * guile/scm-breakpoint.c (gdbscm_register_breakpoint_x): Update. * completer.c (location_completer): Update. * cli/cli-cmds.c (edit_command, list_command): Update. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint) (create_thread_event_breakpoint): Update. (init_breakpoint_sal): Update. Remove some dead code. (create_breakpoint_sal): Change type of "location". Update. (create_breakpoints_sal, create_breakpoint, break_command_1) (dprintf_command, break_range_command, until_break_command) (init_ada_exception_breakpoint) (strace_marker_create_sals_from_location) (update_static_tracepoint, trace_command, ftrace_command) (strace_command, create_tracepoint_from_upload): Update. * break-catch-throw.c (re_set_exception_catchpoint): Update. * ax-gdb.c (agent_command_1): Update.
This commit is contained in:
@@ -828,28 +828,25 @@ edit_command (char *arg, int from_tty)
|
||||
}
|
||||
else
|
||||
{
|
||||
struct cleanup *cleanup;
|
||||
struct event_location *location;
|
||||
char *arg1;
|
||||
|
||||
/* Now should only be one argument -- decode it in SAL. */
|
||||
arg1 = arg;
|
||||
location = string_to_event_location (&arg1, current_language);
|
||||
cleanup = make_cleanup_delete_event_location (location);
|
||||
sals = decode_line_1 (location, DECODE_LINE_LIST_MODE, NULL, NULL, 0);
|
||||
event_location_up location = string_to_event_location (&arg1,
|
||||
current_language);
|
||||
sals = decode_line_1 (location.get (), DECODE_LINE_LIST_MODE,
|
||||
NULL, NULL, 0);
|
||||
|
||||
filter_sals (&sals);
|
||||
if (! sals.nelts)
|
||||
{
|
||||
/* C++ */
|
||||
do_cleanups (cleanup);
|
||||
return;
|
||||
}
|
||||
if (sals.nelts > 1)
|
||||
{
|
||||
ambiguous_line_spec (&sals);
|
||||
xfree (sals.sals);
|
||||
do_cleanups (cleanup);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -891,7 +888,6 @@ edit_command (char *arg, int from_tty)
|
||||
|
||||
if (sal.symtab == 0)
|
||||
error (_("No line number known for %s."), arg);
|
||||
do_cleanups (cleanup);
|
||||
}
|
||||
|
||||
if ((editor = (char *) getenv ("EDITOR")) == NULL)
|
||||
@@ -920,9 +916,6 @@ list_command (char *arg, int from_tty)
|
||||
int dummy_beg = 0;
|
||||
int linenum_beg = 0;
|
||||
char *p;
|
||||
struct cleanup *cleanup;
|
||||
|
||||
cleanup = make_cleanup (null_cleanup, NULL);
|
||||
|
||||
/* Pull in the current default source line if necessary. */
|
||||
if (arg == NULL || ((arg[0] == '+' || arg[0] == '-') && arg[1] == '\0'))
|
||||
@@ -985,24 +978,21 @@ list_command (char *arg, int from_tty)
|
||||
dummy_beg = 1;
|
||||
else
|
||||
{
|
||||
struct event_location *location;
|
||||
|
||||
location = string_to_event_location (&arg1, current_language);
|
||||
make_cleanup_delete_event_location (location);
|
||||
sals = decode_line_1 (location, DECODE_LINE_LIST_MODE, NULL, NULL, 0);
|
||||
event_location_up location = string_to_event_location (&arg1,
|
||||
current_language);
|
||||
sals = decode_line_1 (location.get (), DECODE_LINE_LIST_MODE,
|
||||
NULL, NULL, 0);
|
||||
|
||||
filter_sals (&sals);
|
||||
if (!sals.nelts)
|
||||
{
|
||||
/* C++ */
|
||||
do_cleanups (cleanup);
|
||||
return;
|
||||
}
|
||||
if (sals.nelts > 1)
|
||||
{
|
||||
ambiguous_line_spec (&sals);
|
||||
xfree (sals.sals);
|
||||
do_cleanups (cleanup);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1027,28 +1017,22 @@ list_command (char *arg, int from_tty)
|
||||
dummy_end = 1;
|
||||
else
|
||||
{
|
||||
struct event_location *location;
|
||||
|
||||
location = string_to_event_location (&arg1, current_language);
|
||||
make_cleanup_delete_event_location (location);
|
||||
event_location_up location
|
||||
= string_to_event_location (&arg1, current_language);
|
||||
if (dummy_beg)
|
||||
sals_end = decode_line_1 (location,
|
||||
sals_end = decode_line_1 (location.get (),
|
||||
DECODE_LINE_LIST_MODE, NULL, NULL, 0);
|
||||
else
|
||||
sals_end = decode_line_1 (location, DECODE_LINE_LIST_MODE,
|
||||
sals_end = decode_line_1 (location.get (), DECODE_LINE_LIST_MODE,
|
||||
NULL, sal.symtab, sal.line);
|
||||
|
||||
filter_sals (&sals_end);
|
||||
if (sals_end.nelts == 0)
|
||||
{
|
||||
do_cleanups (cleanup);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
if (sals_end.nelts > 1)
|
||||
{
|
||||
ambiguous_line_spec (&sals_end);
|
||||
xfree (sals_end.sals);
|
||||
do_cleanups (cleanup);
|
||||
return;
|
||||
}
|
||||
sal_end = sals_end.sals[0];
|
||||
@@ -1129,7 +1113,6 @@ list_command (char *arg, int from_tty)
|
||||
? sal.line + get_lines_to_list ()
|
||||
: sal_end.line + 1),
|
||||
0);
|
||||
do_cleanups (cleanup);
|
||||
}
|
||||
|
||||
/* Subroutine of disassemble_command to simplify it.
|
||||
|
||||
Reference in New Issue
Block a user