From patchwork Tue Oct 10 18:03:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 23431 Received: (qmail 99366 invoked by alias); 10 Oct 2017 18:03:42 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 99314 invoked by uid 89); 10 Oct 2017 18:03:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.2 spammy=3766 X-HELO: sesbmg23.ericsson.net Received: from sesbmg23.ericsson.net (HELO sesbmg23.ericsson.net) (193.180.251.37) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Oct 2017 18:03:38 +0000 Received: from ESESSHC016.ericsson.se (Unknown_Domain [153.88.183.66]) by sesbmg23.ericsson.net (Symantec Mail Security) with SMTP id BA.79.03220.97B0DD95; Tue, 10 Oct 2017 20:03:37 +0200 (CEST) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (153.88.183.145) by oa.msg.ericsson.com (153.88.183.66) with Microsoft SMTP Server (TLS) id 14.3.352.0; Tue, 10 Oct 2017 20:03:36 +0200 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; Received: from elxacz23q12.ca.am.ericsson.se (192.75.88.130) by AM3PR07MB308.eurprd07.prod.outlook.com (2a01:111:e400:881b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.5; Tue, 10 Oct 2017 18:03:34 +0000 From: Simon Marchi To: CC: Simon Marchi Subject: [PATCH 4/4] Make to_traceframe_info return a unique_ptr Date: Tue, 10 Oct 2017 14:03:13 -0400 Message-ID: <1507658593-28825-4-git-send-email-simon.marchi@ericsson.com> In-Reply-To: <1507658593-28825-1-git-send-email-simon.marchi@ericsson.com> References: <1507658593-28825-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 X-ClientProxiedBy: SN2PR00CA0038.namprd00.prod.outlook.com (2603:10b6:804:1::48) To AM3PR07MB308.eurprd07.prod.outlook.com (2a01:111:e400:881b::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ff902ec3-e959-4baa-64c2-08d5100939d7 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:AM3PR07MB308; X-Microsoft-Exchange-Diagnostics: 1; AM3PR07MB308; 3:PUkufXhFWpY8Ln2toFjBb00z24stNlm7tlHcPg7BMnZxDAXyeDIf7Z1Eqjv91I1qBCxLPuhf0PzrueLj99ecKBoWg5uQ2OKInUpbmVCpjM5C1sU4YkMgmFd1Zp2dHY/9L1Upf7cgfCdeAaXu+8Xot/oiUZeXoHg10LO0soz1SZxHutMknV8rfHeee5ISnjnUC689CIcbVmhx9oTkf8yGgSulpX1c0ewLxGlH/Xh/t96O6irFncrwIB4iz/wtv8Jm; 25:5Ml8NDyrKXyJ7StO3kQFXmyQzXcdYXQYnBegnV8R8r7wnqyAErf/aAayPUdk5MnqS/YRwyUo/6V1wgwBscfst7xS676Xl6T0JH4+ajEHlabzoSIfUsNVU4EIG1Y5xpN1FoaYeqLUhKg5FgPCSe9xKWJ592zHxpQRy7hD1SFNnmbP8anITmB90dfG5qrArGQL3qnCAlcuk80vnNxWBhFejFe6OHfm+zI7ffqXkZjETSn1Jg0l4CWS9CRFBTtl7BLisiV5DuYr6bm6BpFsteZqYcCCVuNEsxtheYrEOeQJZmGBKYtp3o38tDYkBakdBvF8HLVMrANHR086tw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wOhe8GSGL2gN0yk95JbuK6AJytsAdw17S0AOnuyU9rRCn6KwChJkCdjeNL6oScJxH8BLzB41OrO5oNhI= X-Exchange-Antispam-Report-Test: UriScan:(131327999870524); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(6041248)(20161123555025)(20161123560025)(20161123564025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM3PR07MB308; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM3PR07MB308; X-Forefront-PRVS: 04569283F9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(376002)(346002)(189002)(43544003)(199003)(54534003)(50466002)(25786009)(5660300001)(33646002)(2906002)(16586007)(316002)(4326008)(106356001)(8676002)(81166006)(575784001)(8936002)(81156014)(189998001)(48376002)(86362001)(6506006)(68736007)(478600001)(6486002)(97736004)(6512007)(5003940100001)(50986999)(105586002)(3846002)(2351001)(2361001)(7736002)(16526018)(101416001)(36756003)(76176999)(2950100002)(6116002)(6916009)(53936002)(6666003)(50226002)(66066001)(305945005)(47776003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR07MB308; H:elxacz23q12.ca.am.ericsson.se; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM3PR07MB308; 23:NPSIYNiX5Bp6pPPUcSxn3SBlw9ypxz96TssoMbeD5j?= =?us-ascii?Q?hUcz6ioD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UD5PUOIHhqONTW+qw86X4n43Akky6B7mF/n7mB38cQEDsyFSHWSXxBKJy0wwpjHP/psvdpTyKqcI95kBY+yu5R4NRJxbKgXTqb6KAltV1000dSfEHkIDrEZed8sE3IwYW3wZAmTt+geZXpoYMXU75STstvGs0eI1Gf8u5qE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2017 18:03:34.6460 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR07MB308 X-OriginatorOrg: ericsson.com X-IsSubscribed: yes From: Simon Marchi Since this target method returns an allocated object, return a unique_ptr. It allows getting rid a some cleanups here and there. I had to shuffle the includes around. First, target.h now needs to include tracepoint.h, to get the definition of traceframe_info_up. However, the definition of enum trace_find_type was later in target, so I had to move it to tracepoint.h, so that the declaration of tfind_1 could know about it. I then had to remove the include of target.h from tracepoint.h, which caused a circular dependency (it was probably included to get enum trace_find_type in the first place anyway). Regression tested on the buildbot. gdb/ChangeLog: * target.h: Include tracepoint.h. (enum trace_find_type): Move to tracepoint.h. (struct target_ops) : Return a unique ptr. * tracepoint.h: Don't include target.h (enum trace_find_type): Move from target.h. (parse_traceframe_info): Return a unique ptr. * tracepoint.c (current_traceframe_info): Change type to unique ptr. (free_traceframe_info): Remove. (clear_traceframe_info): Don't manually free current_traceframe_info. (free_result): Remove. (parse_traceframe_info): Return a unique ptr. (get_traceframe_info): Adjust to unique ptr. * ctf.c (ctf_traceframe_info): Return a unique ptr. * remote.c (remote_traceframe_info): Return a unique ptr. * tracefile-tfile.c (tfile_traceframe_info): Return a unique ptr. * target-debug.h (target_debug_print_traceframe_info_up): New macro. * target-delegates.c: Regenerate. --- gdb/ctf.c | 4 ++-- gdb/remote.c | 5 ++--- gdb/target-debug.h | 2 ++ gdb/target-delegates.c | 10 +++++----- gdb/target.h | 17 +++-------------- gdb/tracefile-tfile.c | 7 ++++--- gdb/tracepoint.c | 40 ++++++---------------------------------- gdb/tracepoint.h | 17 +++++++++++++++-- 8 files changed, 39 insertions(+), 63 deletions(-) diff --git a/gdb/ctf.c b/gdb/ctf.c index bef6f30..21ed113 100644 --- a/gdb/ctf.c +++ b/gdb/ctf.c @@ -1635,10 +1635,10 @@ ctf_trace_find (struct target_ops *self, enum trace_find_type type, int num, frame, extract memory range information, and return them in traceframe_info. */ -static struct traceframe_info * +static traceframe_info_up ctf_traceframe_info (struct target_ops *self) { - traceframe_info *info = new traceframe_info; + traceframe_info_up info (new traceframe_info); const char *name; struct bt_iter_pos *pos; diff --git a/gdb/remote.c b/gdb/remote.c index 3ceabcf..c1a0228 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -13061,7 +13061,7 @@ remote_set_circular_trace_buffer (struct target_ops *self, int val) error (_("Bogus reply from target: %s"), reply); } -static struct traceframe_info * +static traceframe_info_up remote_traceframe_info (struct target_ops *self) { char *text; @@ -13070,10 +13070,9 @@ remote_traceframe_info (struct target_ops *self) TARGET_OBJECT_TRACEFRAME_INFO, NULL); if (text != NULL) { - struct traceframe_info *info; struct cleanup *back_to = make_cleanup (xfree, text); + traceframe_info_up info = parse_traceframe_info (text); - info = parse_traceframe_info (text); do_cleanups (back_to); return info; } diff --git a/gdb/target-debug.h b/gdb/target-debug.h index 7477ce6..580ecd4 100644 --- a/gdb/target-debug.h +++ b/gdb/target-debug.h @@ -164,6 +164,8 @@ target_debug_do_print (plongest (X)) #define target_debug_print_gdb_disassembly_flags(X) \ target_debug_do_print (plongest (X)) +#define target_debug_print_traceframe_info_up(X) \ + target_debug_do_print (host_address_to_string (X.get ())) static void target_debug_print_struct_target_waitstatus_p (struct target_waitstatus *status) diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index c981796..00efbb1 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -3357,29 +3357,29 @@ debug_static_tracepoint_markers_by_strid (struct target_ops *self, const char *a return result; } -static struct traceframe_info * +static traceframe_info_up delegate_traceframe_info (struct target_ops *self) { self = self->beneath; return self->to_traceframe_info (self); } -static struct traceframe_info * +static traceframe_info_up tdefault_traceframe_info (struct target_ops *self) { tcomplain (); } -static struct traceframe_info * +static traceframe_info_up debug_traceframe_info (struct target_ops *self) { - struct traceframe_info * result; + traceframe_info_up result; fprintf_unfiltered (gdb_stdlog, "-> %s->to_traceframe_info (...)\n", debug_target.to_shortname); result = debug_target.to_traceframe_info (&debug_target); fprintf_unfiltered (gdb_stdlog, "<- %s->to_traceframe_info (", debug_target.to_shortname); target_debug_print_struct_target_ops_p (&debug_target); fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_struct_traceframe_info_p (result); + target_debug_print_traceframe_info_up (result); fputs_unfiltered ("\n", gdb_stdlog); return result; } diff --git a/gdb/target.h b/gdb/target.h index f5ad1e5..581c89b 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -76,6 +76,7 @@ struct inferior; #include "record.h" #include "command.h" #include "disasm.h" +#include "tracepoint.h" #include "break-common.h" /* For enum target_hw_bp_type. */ @@ -235,18 +236,6 @@ enum target_xfer_status extern const char * target_xfer_status_to_string (enum target_xfer_status status); -/* Enumeration of the kinds of traceframe searches that a target may - be able to perform. */ - -enum trace_find_type - { - tfind_number, - tfind_pc, - tfind_tp, - tfind_range, - tfind_outside, - }; - typedef struct static_tracepoint_marker *static_tracepoint_marker_p; DEF_VEC_P(static_tracepoint_marker_p); @@ -1116,8 +1105,8 @@ struct target_ops traceframe's contents. This method should not cache data; higher layers take care of caching, invalidating, and re-fetching when necessary. */ - struct traceframe_info *(*to_traceframe_info) (struct target_ops *) - TARGET_DEFAULT_NORETURN (tcomplain ()); + traceframe_info_up (*to_traceframe_info) (struct target_ops *) + TARGET_DEFAULT_NORETURN (tcomplain ()); /* Ask the target to use or not to use agent according to USE. Return 1 successful, 0 otherwise. */ diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c index cc77b6c..727570c 100644 --- a/gdb/tracefile-tfile.c +++ b/gdb/tracefile-tfile.c @@ -1088,12 +1088,13 @@ build_traceframe_info (char blocktype, void *data) return 0; } -static struct traceframe_info * +static traceframe_info_up tfile_traceframe_info (struct target_ops *self) { - traceframe_info *info = new traceframe_info; + traceframe_info_up info (new traceframe_info); + + traceframe_walk_blocks (build_traceframe_info, 0, info.get ()); - traceframe_walk_blocks (build_traceframe_info, 0, info); return info; } diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 9f0d07b..8264632 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -133,7 +133,7 @@ static int tracepoint_number; yet attempted to fetch it, or if the target does not support fetching this object, or if we're not inspecting a traceframe presently. */ -static struct traceframe_info *current_traceframe_info; +static traceframe_info_up current_traceframe_info; /* Tracing command lists. */ static struct cmd_list_element *tfindlist; @@ -191,21 +191,12 @@ current_trace_status (void) return &trace_status; } -/* Destroy INFO. */ - -static void -free_traceframe_info (struct traceframe_info *info) -{ - delete info; -} - /* Free and clear the traceframe info cache of the current traceframe. */ static void clear_traceframe_info (void) { - free_traceframe_info (current_traceframe_info); current_traceframe_info = NULL; } @@ -4020,16 +4011,6 @@ traceframe_info_start_tvar (struct gdb_xml_parser *parser, info->tvars.push_back (id); } -/* Discard the constructed trace frame info (if an error occurs). */ - -static void -free_result (void *p) -{ - struct traceframe_info *result = (struct traceframe_info *) p; - - free_traceframe_info (result); -} - /* The allowed elements and attributes for an XML memory map. */ static const struct gdb_xml_attribute memory_attributes[] = { @@ -4061,25 +4042,16 @@ static const struct gdb_xml_element traceframe_info_elements[] = { /* Parse a traceframe-info XML document. */ -struct traceframe_info * +traceframe_info_up parse_traceframe_info (const char *tframe_info) { - traceframe_info *result = new traceframe_info; - struct cleanup *back_to; - - back_to = make_cleanup (free_result, result); + traceframe_info_up result (new traceframe_info); if (gdb_xml_parse_quick (_("trace frame info"), "traceframe-info.dtd", traceframe_info_elements, - tframe_info, result) == 0) - { - /* Parsed successfully, keep the result. */ - discard_cleanups (back_to); - - return result; - } + tframe_info, result.get ()) == 0) + return result; - do_cleanups (back_to); return NULL; } @@ -4095,7 +4067,7 @@ get_traceframe_info (void) if (current_traceframe_info == NULL) current_traceframe_info = target_traceframe_info (); - return current_traceframe_info; + return current_traceframe_info.get (); } /* If the target supports the query, return in RESULT the set of diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h index 872681d..88c18c3 100644 --- a/gdb/tracepoint.h +++ b/gdb/tracepoint.h @@ -20,7 +20,6 @@ #define TRACEPOINT_H 1 #include "breakpoint.h" -#include "target.h" #include "memrange.h" #include "gdb_vecs.h" @@ -38,6 +37,8 @@ struct traceframe_info std::vector tvars; }; +typedef std::unique_ptr traceframe_info_up; + /* A trace state variable is a value managed by a target being traced. A trace state variable (or tsv for short) can be accessed and assigned to by tracepoint actions and conditionals, but is not @@ -376,6 +377,18 @@ extern void trace_status_mi (int on_stop); extern void tvariables_info_1 (void); extern void save_trace_state_variables (struct ui_file *fp); +/* Enumeration of the kinds of traceframe searches that a target may + be able to perform. */ + +enum trace_find_type +{ + tfind_number, + tfind_pc, + tfind_tp, + tfind_range, + tfind_outside, +}; + extern void tfind_1 (enum trace_find_type type, int num, CORE_ADDR addr1, CORE_ADDR addr2, int from_tty); @@ -385,7 +398,7 @@ extern void trace_save_tfile (const char *filename, extern void trace_save_ctf (const char *dirname, int target_does_save); -extern struct traceframe_info *parse_traceframe_info (const char *tframe_info); +extern traceframe_info_up parse_traceframe_info (const char *tframe_info); extern int traceframe_available_memory (VEC(mem_range_s) **result, CORE_ADDR memaddr, ULONGEST len);