diff options
author | Tom Tromey <tom@tromey.com> | 2017-04-05 20:44:01 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-04-12 11:16:17 -0600 |
commit | ffc2605c41d026cf5710704848b7c3b1cdbdcf49 (patch) | |
tree | 6c4aaafe7149de5784c2c8fcd3ab53047bce2417 /gdb/linespec.c | |
parent | 8f10c9323357ad190c0383f2fc9d394316447905 (diff) | |
download | gdb-ffc2605c41d026cf5710704848b7c3b1cdbdcf49.zip gdb-ffc2605c41d026cf5710704848b7c3b1cdbdcf49.tar.gz gdb-ffc2605c41d026cf5710704848b7c3b1cdbdcf49.tar.bz2 |
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.
Diffstat (limited to 'gdb/linespec.c')
-rw-r--r-- | gdb/linespec.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/gdb/linespec.c b/gdb/linespec.c index dcbe253..41b82d7 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -1751,7 +1751,7 @@ canonicalize_linespec (struct linespec_state *state, const linespec_p ls) /* Save everything as an explicit location. */ canon = state->canonical->location - = new_explicit_location (&ls->explicit_loc); + = new_explicit_location (&ls->explicit_loc).release (); explicit_loc = get_explicit_location (canon); if (explicit_loc->label_name != NULL) @@ -2491,7 +2491,7 @@ event_location_to_sals (linespec_parser *parser, addr = linespec_expression_to_pc (&const_expr); if (PARSER_STATE (parser)->canonical != NULL) PARSER_STATE (parser)->canonical->location - = copy_event_location (location); + = copy_event_location (location).release (); do_cleanups (cleanup); } @@ -2630,8 +2630,6 @@ decode_line_with_current_source (char *string, int flags) { struct symtabs_and_lines sals; struct symtab_and_line cursal; - struct event_location *location; - struct cleanup *cleanup; if (string == 0) error (_("Empty line specification.")); @@ -2640,15 +2638,14 @@ decode_line_with_current_source (char *string, int flags) and get a default source symtab+line or it will recursively call us! */ cursal = get_current_source_symtab_and_line (); - location = string_to_event_location (&string, current_language); - cleanup = make_cleanup_delete_event_location (location); - sals = decode_line_1 (location, flags, NULL, + event_location_up location = string_to_event_location (&string, + current_language); + sals = decode_line_1 (location.get (), flags, NULL, cursal.symtab, cursal.line); if (*string) error (_("Junk at end of line specification: %s"), string); - do_cleanups (cleanup); return sals; } @@ -2658,25 +2655,23 @@ struct symtabs_and_lines decode_line_with_last_displayed (char *string, int flags) { struct symtabs_and_lines sals; - struct event_location *location; - struct cleanup *cleanup; if (string == 0) error (_("Empty line specification.")); - location = string_to_event_location (&string, current_language); - cleanup = make_cleanup_delete_event_location (location); + event_location_up location = string_to_event_location (&string, + current_language); if (last_displayed_sal_is_valid ()) - sals = decode_line_1 (location, flags, NULL, + sals = decode_line_1 (location.get (), flags, NULL, get_last_displayed_symtab (), get_last_displayed_line ()); else - sals = decode_line_1 (location, flags, NULL, (struct symtab *) NULL, 0); + sals = decode_line_1 (location.get (), flags, NULL, + (struct symtab *) NULL, 0); if (*string) error (_("Junk at end of line specification: %s"), string); - do_cleanups (cleanup); return sals; } @@ -2785,7 +2780,7 @@ decode_objc (struct linespec_state *self, linespec_p ls, const char *arg) str = xstrdup (saved_arg); make_cleanup (xfree, str); - self->canonical->location = new_linespec_location (&str); + self->canonical->location = new_linespec_location (&str).release (); } } |