From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA v2 17/17] Change linespec_result::location to be an event_location_up
Date: Tue, 11 Apr 2017 15:01:00 -0000 [thread overview]
Message-ID: <20170411150112.23207-18-tom@tromey.com> (raw)
In-Reply-To: <20170411150112.23207-1-tom@tromey.com>
This is a follow-up to another patch. It changes
linespec_result::location to be an event_location_up.
gdb/ChangeLog
2017-04-11 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.
---
gdb/ChangeLog | 16 ++++++++++++++++
gdb/breakpoint.c | 12 +++++++-----
gdb/linespec.c | 10 +++++-----
gdb/linespec.h | 6 +++---
gdb/location.c | 4 +---
gdb/location.h | 9 +--------
gdb/probe.c | 2 +-
7 files changed, 34 insertions(+), 25 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fc600b1..b842af0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,21 @@
2017-04-11 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-11 Tom Tromey <tom@tromey.com>
+
* linespec.h (struct linespec_result): Add constructor and
destructor.
(init_linespec_result, destroy_linespec_result)
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 42f344a..42e2e6d 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -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,
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 51fa128..acf4900 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -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);
diff --git a/gdb/linespec.h b/gdb/linespec.h
index 7459ff8..ee8b9ae 100644
--- a/gdb/linespec.h
+++ b/gdb/linespec.h
@@ -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
destroy_linespec_result. */
diff --git a/gdb/location.c b/gdb/location.c
index 8aa8bd5..8796320 100644
--- a/gdb/location.c
+++ b/gdb/location.c
@@ -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)
{
diff --git a/gdb/location.h b/gdb/location.h
index 5a5adb5..7e1f012 100644
--- a/gdb/location.h
+++ b/gdb/location.h
@@ -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. */
diff --git a/gdb/probe.c b/gdb/probe.c
index 4f4a5a3..c147810 100644
--- a/gdb/probe.c
+++ b/gdb/probe.c
@@ -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);
--
2.9.3
next prev parent reply other threads:[~2017-04-11 15:01 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-11 15:02 [RFA v2 00/17] miscellaneous C++-ification Tom Tromey
2017-04-11 15:01 ` [RFA v2 04/17] Introduce gdb_dlhandle_up Tom Tromey
2017-04-11 15:01 ` Tom Tromey [this message]
2017-04-12 2:39 ` [RFA v2 17/17] Change linespec_result::location to be an event_location_up Simon Marchi
2017-04-11 15:01 ` [RFA v2 10/17] C++ify mi_parse Tom Tromey
2017-04-12 11:26 ` Pedro Alves
2017-04-12 16:15 ` Tom Tromey
2017-04-12 16:19 ` Pedro Alves
2017-04-12 18:05 ` Tom Tromey
2017-04-12 18:37 ` Pedro Alves
2017-04-12 19:25 ` Tom Tromey
2017-04-13 2:36 ` Pedro Alves
2017-04-13 13:44 ` Tom Tromey
2017-04-11 15:01 ` [RFA v2 01/17] Introduce event_location_up Tom Tromey
2017-04-11 15:01 ` [RFA v2 09/17] Remove some cleanups from location.c Tom Tromey
2017-04-11 15:01 ` [RFA v2 11/17] Use scoped_restore in more places Tom Tromey
2017-04-11 15:01 ` [RFA v2 16/17] Add a constructor and destructor to linespec_result Tom Tromey
2017-04-12 2:25 ` Simon Marchi
2017-04-12 14:30 ` Tom Tromey
2017-04-11 15:01 ` [RFA v2 02/17] Introduce command_line_up Tom Tromey
2017-04-11 15:01 ` [RFA v2 12/17] Use std::vector in reread_symbols Tom Tromey
2017-04-11 15:01 ` [RFA v2 05/17] Change increment_reading_symtab to return a scoped_restore Tom Tromey
2017-04-12 11:16 ` Pedro Alves
2017-04-12 14:31 ` Tom Tromey
2017-04-11 15:02 ` [RFA v2 08/17] Remove some cleanups from gnu-v3-abi.c Tom Tromey
2017-04-11 15:02 ` [RFA v2 07/17] Fix up wchar_iterator comment Tom Tromey
2017-04-11 15:02 ` [RFA v2 13/17] Use std::vector in find_instruction_backward Tom Tromey
2017-04-11 15:21 ` [RFA v2 03/17] Change find_pcs_for_symtab_line to return a std::vector Tom Tromey
2017-04-11 15:21 ` [RFA v2 06/17] Remove cleanup_iconv Tom Tromey
2017-04-12 11:19 ` Pedro Alves
2017-04-12 15:05 ` Tom Tromey
2017-04-11 15:22 ` [RFA v2 14/17] Use std::vector in compile-loc2c.c Tom Tromey
2017-04-11 15:23 ` [RFA v2 15/17] Change breakpoint event locations to event_location_up Tom Tromey
2017-04-12 2:25 ` Simon Marchi
2017-04-12 2:49 ` [RFA v2 00/17] miscellaneous C++-ification Simon Marchi
2017-04-12 11:38 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170411150112.23207-18-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox