mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-23 10:03:47 +08:00
Change linespec_result::location to be an event_location_up
This is a follow-up to another patch. It changes linespec_result::location to be an event_location_up. gdb/ChangeLog 2017-04-12 Tom Tromey <tom@tromey.com> * probe.c (parse_probes): Update. * location.h (delete_event_location): Don't declare. (event_location_deleter::operator()): Update. * location.c (event_location_deleter::operator()): Rename from delete_event_location. * linespec.h (linespec_result) <location>: Change type to event_location_up. * linespec.c (canonicalize_linespec, event_location_to_sals) (decode_objc): Update. (linespec_result): Don't call delete_event_location. * breakpoint.c (create_breakpoints_sal) (bkpt_probe_create_sals_from_location) (strace_marker_create_sals_from_location): Update.
This commit is contained in:
parent
16e802b9c0
commit
8e9e35b180
@ -1,3 +1,19 @@
|
||||
2017-04-12 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* probe.c (parse_probes): Update.
|
||||
* location.h (delete_event_location): Don't declare.
|
||||
(event_location_deleter::operator()): Update.
|
||||
* location.c (event_location_deleter::operator()): Rename from
|
||||
delete_event_location.
|
||||
* linespec.h (linespec_result) <location>: Change type to
|
||||
event_location_up.
|
||||
* linespec.c (canonicalize_linespec, event_location_to_sals)
|
||||
(decode_objc): Update.
|
||||
(linespec_result): Don't call delete_event_location.
|
||||
* breakpoint.c (create_breakpoints_sal)
|
||||
(bkpt_probe_create_sals_from_location)
|
||||
(strace_marker_create_sals_from_location): Update.
|
||||
|
||||
2017-04-12 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* linespec.h (struct linespec_result): Add constructor and
|
||||
|
@ -9429,7 +9429,7 @@ create_breakpoints_sal (struct gdbarch *gdbarch,
|
||||
'break', without arguments. */
|
||||
event_location_up location
|
||||
= (canonical->location != NULL
|
||||
? copy_event_location (canonical->location) : NULL);
|
||||
? copy_event_location (canonical->location.get ()) : NULL);
|
||||
char *filter_string = lsal->canonical ? xstrdup (lsal->canonical) : NULL;
|
||||
|
||||
make_cleanup (xfree, filter_string);
|
||||
@ -13390,7 +13390,8 @@ bkpt_probe_create_sals_from_location (const struct event_location *location,
|
||||
struct linespec_sals lsal;
|
||||
|
||||
lsal.sals = parse_probes (location, NULL, canonical);
|
||||
lsal.canonical = xstrdup (event_location_to_string (canonical->location));
|
||||
lsal.canonical
|
||||
= xstrdup (event_location_to_string (canonical->location.get ()));
|
||||
VEC_safe_push (linespec_sals, canonical->sals, &lsal);
|
||||
}
|
||||
|
||||
@ -13646,10 +13647,11 @@ strace_marker_create_sals_from_location (const struct event_location *location,
|
||||
|
||||
str = savestring (arg_start, arg - arg_start);
|
||||
cleanup = make_cleanup (xfree, str);
|
||||
canonical->location = new_linespec_location (&str).release ();
|
||||
canonical->location = new_linespec_location (&str);
|
||||
do_cleanups (cleanup);
|
||||
|
||||
lsal.canonical = xstrdup (event_location_to_string (canonical->location));
|
||||
lsal.canonical
|
||||
= xstrdup (event_location_to_string (canonical->location.get ()));
|
||||
VEC_safe_push (linespec_sals, canonical->sals, &lsal);
|
||||
}
|
||||
|
||||
@ -13686,7 +13688,7 @@ strace_marker_create_breakpoints_sal (struct gdbarch *gdbarch,
|
||||
expanded.nelts = 1;
|
||||
expanded.sals = &lsal->sals.sals[i];
|
||||
|
||||
location = copy_event_location (canonical->location);
|
||||
location = copy_event_location (canonical->location.get ());
|
||||
|
||||
tp = new tracepoint ();
|
||||
init_breakpoint_sal (&tp->base, gdbarch, expanded,
|
||||
|
@ -1750,8 +1750,9 @@ canonicalize_linespec (struct linespec_state *state, const linespec_p ls)
|
||||
return;
|
||||
|
||||
/* Save everything as an explicit location. */
|
||||
canon = state->canonical->location
|
||||
= new_explicit_location (&ls->explicit_loc).release ();
|
||||
state->canonical->location
|
||||
= new_explicit_location (&ls->explicit_loc);
|
||||
canon = state->canonical->location.get ();
|
||||
explicit_loc = get_explicit_location (canon);
|
||||
|
||||
if (explicit_loc->label_name != NULL)
|
||||
@ -2491,7 +2492,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).release ();
|
||||
= copy_event_location (location);
|
||||
|
||||
do_cleanups (cleanup);
|
||||
}
|
||||
@ -2780,7 +2781,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).release ();
|
||||
self->canonical->location = new_linespec_location (&str);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3892,7 +3893,6 @@ linespec_result::~linespec_result ()
|
||||
int i;
|
||||
struct linespec_sals *lsal;
|
||||
|
||||
delete_event_location (location);
|
||||
for (i = 0; VEC_iterate (linespec_sals, sals, i, lsal); ++i)
|
||||
{
|
||||
xfree (lsal->canonical);
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
struct symtab;
|
||||
|
||||
#include "location.h"
|
||||
#include "vec.h"
|
||||
|
||||
/* Flags to pass to decode_line_1 and decode_line_full. */
|
||||
@ -61,7 +62,6 @@ struct linespec_result
|
||||
linespec_result ()
|
||||
: special_display (0),
|
||||
pre_expanded (0),
|
||||
location (NULL),
|
||||
sals (NULL)
|
||||
{
|
||||
}
|
||||
@ -83,8 +83,8 @@ struct linespec_result
|
||||
int pre_expanded;
|
||||
|
||||
/* If PRE_EXPANDED is non-zero, this is set to the location entered
|
||||
by the user. This will be freed by destroy_linespec_result. */
|
||||
struct event_location *location;
|
||||
by the user. */
|
||||
event_location_up location;
|
||||
|
||||
/* The sals. The vector will be freed by the destructor. */
|
||||
VEC (linespec_sals) *sals;
|
||||
|
@ -342,10 +342,8 @@ copy_event_location (const struct event_location *src)
|
||||
return event_location_up (dst);
|
||||
}
|
||||
|
||||
/* See description in location.h. */
|
||||
|
||||
void
|
||||
delete_event_location (struct event_location *location)
|
||||
event_location_deleter::operator() (event_location *location) const
|
||||
{
|
||||
if (location != NULL)
|
||||
{
|
||||
|
@ -114,18 +114,11 @@ extern char *
|
||||
extern const char *
|
||||
event_location_to_string (struct event_location *location);
|
||||
|
||||
/* Free an event location and any associated data. */
|
||||
|
||||
extern void delete_event_location (struct event_location *location);
|
||||
|
||||
/* A deleter for a struct event_location. */
|
||||
|
||||
struct event_location_deleter
|
||||
{
|
||||
void operator() (event_location *location) const
|
||||
{
|
||||
delete_event_location (location);
|
||||
}
|
||||
void operator() (event_location *location) const;
|
||||
};
|
||||
|
||||
/* A unique pointer for event_location. */
|
||||
|
@ -205,7 +205,7 @@ parse_probes (const struct event_location *location,
|
||||
make_cleanup (xfree, canon);
|
||||
canonical->special_display = 1;
|
||||
canonical->pre_expanded = 1;
|
||||
canonical->location = new_probe_location (canon).release ();
|
||||
canonical->location = new_probe_location (canon);
|
||||
}
|
||||
|
||||
do_cleanups (cleanup);
|
||||
|
Loading…
Reference in New Issue
Block a user