From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111048 invoked by alias); 11 Apr 2017 15:01:41 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 98505 invoked by uid 89); 11 Apr 2017 15:01:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=(unknown) X-HELO: gproxy7-pub.mail.unifiedlayer.com Received: from gproxy7-pub.mail.unifiedlayer.com (HELO gproxy7-pub.mail.unifiedlayer.com) (70.40.196.235) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Tue, 11 Apr 2017 15:01:27 +0000 Received: (qmail 22225 invoked by uid 0); 11 Apr 2017 15:01:27 -0000 Received: from unknown (HELO cmgw4) (10.0.90.85) by gproxy7.mail.unifiedlayer.com with SMTP; 11 Apr 2017 15:01:27 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by cmgw4 with id 731Q1v01M2f2jeq0131Tyq; Tue, 11 Apr 2017 09:01:27 -0600 X-Authority-Analysis: v=2.2 cv=QdwWhoTv c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=AzvcPWV-tVgA:10 a=zstS-IiYAAAA:8 a=X2uY1CoPem5w5enUDDkA:9 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 75-166-65-226.hlrn.qwest.net ([75.166.65.226]:50042 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1cxxIJ-0007Ml-Sj; Tue, 11 Apr 2017 09:01:24 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA v2 17/17] Change linespec_result::location to be an event_location_up Date: Tue, 11 Apr 2017 15:01:00 -0000 Message-Id: <20170411150112.23207-18-tom@tromey.com> In-Reply-To: <20170411150112.23207-1-tom@tromey.com> References: <20170411150112.23207-1-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1cxxIJ-0007Ml-Sj X-Source-Sender: 75-166-65-226.hlrn.qwest.net (bapiya.Home) [75.166.65.226]:50042 X-Source-Auth: tom+tromey.com X-Email-Count: 18 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-SW-Source: 2017-04/txt/msg00277.txt.bz2 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 * 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) : 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 + * 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) : 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 + * 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