From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18007 invoked by alias); 6 Jun 2017 14:47:48 -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 17963 invoked by uid 89); 6 Jun 2017 14:47:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00,MIME_BASE64_BLANKS,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: EUR01-DB5-obe.outbound.protection.outlook.com Received: from mail-db5eur01on0065.outbound.protection.outlook.com (HELO EUR01-DB5-obe.outbound.protection.outlook.com) (104.47.2.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 06 Jun 2017 14:47:44 +0000 Received: from AM3PR08MB0101.eurprd08.prod.outlook.com (10.160.211.19) by AM3PR08MB0104.eurprd08.prod.outlook.com (10.160.211.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1143.10; Tue, 6 Jun 2017 14:47:45 +0000 Received: from AM3PR08MB0101.eurprd08.prod.outlook.com ([fe80::f0a8:fd0f:69e1:e280]) by AM3PR08MB0101.eurprd08.prod.outlook.com ([fe80::f0a8:fd0f:69e1:e280%17]) with mapi id 15.01.1143.019; Tue, 6 Jun 2017 14:47:44 +0000 From: Alan Hayward To: Yao Qi CC: "gdb-patches@sourceware.org" , nd Subject: Re: [PATCH 6/11] Add ALPHA_MAX_REGISTER_SIZE Date: Tue, 06 Jun 2017 14:47:00 -0000 Message-ID: <1435BE87-6A11-4019-90F8-1DF4486EC997@arm.com> References: <772F5764-0F2A-4F53-BC41-C36AF15BED21@arm.com> <86bms3wbh5.fsf@gmail.com> <86tw3t1ag0.fsf@gmail.com> In-Reply-To: <86tw3t1ag0.fsf@gmail.com> authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=arm.com; x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;AM3PR08MB0104;7:XRhI9ZWcwiNyCuFOlgdLcOoV/BHnf4dN+Hrs7iF8QkpP1TME4IuGAF/ZERqle5VQTJJlN4LMN2BqollHv4ugh20ZAqjI8Mlmobh1WYt2bJxAstN0G3GHGhlyYitCkViyGJ1iP2r9cKtL7umVTYh8nrOXN+aa8iWchy6wIaKDUO4D5JT+c0NES5iBPo+fwJnKa7Y3n+6mkKUgtBaJNInjE6oZRJUyFJOEpHfxSXdsV+VDldJnCNbCYMnBsCWURm6xPxacIJ/kb/yiuPqnVzNMl17AdolUQMbWAI5TWFeY1XXTc7Ye3CBW61BE7gcQ9tBvV7oNQHYLVZjgIDqzROiNFA== x-ms-traffictypediagnostic: AM3PR08MB0104: x-ms-office365-filtering-correlation-id: d046e6ba-cf81-40f8-596d-08d4aceafdf1 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081);SRVR:AM3PR08MB0104; nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6041248)(20161123564025)(20161123555025)(20161123562025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:AM3PR08MB0104;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:AM3PR08MB0104; x-forefront-prvs: 033054F29A x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(39850400002)(39860400002)(39840400002)(39400400002)(39450400003)(39410400002)(54534003)(377424004)(24454002)(8676002)(7736002)(50986999)(8936002)(54356999)(76176999)(305945005)(6506006)(6436002)(81166006)(6512007)(54906002)(6306002)(82746002)(99286003)(6486002)(83716003)(229853002)(2950100002)(189998001)(6916009)(5660300001)(86362001)(1411001)(25786009)(53546009)(4326008)(72206003)(39060400002)(66066001)(966005)(478600001)(102836003)(3846002)(6116002)(93886004)(2906002)(3280700002)(3660700001)(2900100001)(33656002)(36756003)(110136004)(6246003)(53936002)(14454004)(5250100002)(38730400002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM3PR08MB0104;H:AM3PR08MB0101.eurprd08.prod.outlook.com;FPR:;SPF:None;MLV:ovrnspm;PTR:InfoNoRecords;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" Content-ID: <650CBB91E5D17D4DA97099D5E4CB6DCD@eurprd08.prod.outlook.com> Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jun 2017 14:47:44.6360 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR08MB0104 X-SW-Source: 2017-06/txt/msg00146.txt.bz2 DQo+IE9uIDYgSnVuIDIwMTcsIGF0IDE1OjAyLCBZYW8gUWkgPHFpeWFvbHRj QGdtYWlsLmNvbT4gd3JvdGU6DQo+IA0KPiBBbGFuIEhheXdhcmQgPEFsYW4u SGF5d2FyZEBhcm0uY29tPiB3cml0ZXM6DQo+IA0KPj4gSSBkb24ndCBoYXZl IGEgQUxQSEEgbWFjaGluZSB0byB0ZXN0IG9uLg0KPj4gVGVzdGVkIG9uIGEg LS1lbmFibGUtdGFyZ2V0cz1hbGwgYW5kIC0tZW5hYmxlLWxpYnNhbml0aXpl ciBidWlsZCB1c2luZw0KPj4gbWFrZSBjaGVjayB3aXRoIGJvYXJkIGZpbGVz IHVuaXggYW5kIG5hdGl2ZS1nZGJzZXJ2ZXIuDQo+IA0KPiBDb3VsZCB5b3Ug YnVpbGQgR0RCIHdpdGggb3B0aW9uIC1mc2FuaXRpemU9YWRkcmVzcw0KPiAo bWFrZSBDWFhGTEFHUz0nLWZzYW5pdGl6ZT1hZGRyZXNzJykgYW5kIHJ1biBn ZGIuZ2RiL3VuaXR0ZXN0LmV4cD8NCj4gDQo+PiANCj4+IE9rIHRvIGNvbW1p dD8NCj4+IA0KPiANCj4gT0sgaWYgdGhlcmUgaXMgbm8gZmFpbCBpbiB1bml0 IHRlc3RzLg0KDQpUZXN0ZWQgYWxvbmcgd2l0aCB0aGUgSUE2NCBwYXRjaC4N CnVuaXR0ZXN0LmV4cCBwYXNzZXMuDQoNCg0KPiANCj4+IEFsYW4uDQo+PiAN Cj4+IDIwMTctMDUtMzAgIEFsYW4gSGF5d2FyZCAgPGFsYW4uaGF5d2FyZEBh cm0uY29tPg0KPj4gDQo+PiAJKiBhbHBoYS10ZGVwLmMgKGFscGhhX3JlZ2lz dGVyX3RvX3ZhbHVlKTogVXNlIGdldF9mcmFtZV9yZWdpc3Rlcl92YWx1ZS4N Cj4gDQo+IFRoaXMgbGluZSBpcyB0b28gbG9uZy4gIFRoZSBsaW5lIG1heCBs ZW5ndGggaW4gQ2hhbmdlTG9nIGlzIDc0Lg0KPiBodHRwczovL3NvdXJjZXdh cmUub3JnL2dkYi93aWtpL0NvbnRyaWJ1dGlvbkNoZWNrbGlzdCNQcm9wZXJs eV9Gb3JtYXR0ZWRfR05VX0NoYW5nZUxvZw0KDQpTb3JyeSwgdGhhdCB3YXMg bmV3IHRvIG1lIChBcyBmYXIgYXMgSeKAmW0gYXdhcmUsIGdjYyB1c2VzIDgw KS4NCg0KDQo+IA0KPj4gCShhbHBoYV92YWx1ZV90b19yZWdpc3Rlcik6IFVz ZSBBTFBIQV9SRUdJU1RFUl9TSVpFLg0KPiANCj4gDQoNCkNvbW1pdHRlZCB3 aXRoIG5ld2xpbmUgYWRkZWQgaW4gY2hhbmdlbG9nLg0KDQoNCkFsYW4uDQoN Cg== >From gdb-patches-return-139527-listarch-gdb-patches=sources.redhat.com@sourceware.org Tue Jun 06 14:55:32 2017 Return-Path: Delivered-To: listarch-gdb-patches@sources.redhat.com Received: (qmail 55260 invoked by alias); 6 Jun 2017 14:55:31 -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 Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 54051 invoked by uid 89); 6 Jun 2017 14:55:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=93229 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 06 Jun 2017 14:55:28 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E19703B70D for ; Tue, 6 Jun 2017 14:55:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E19703B70D Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E19703B70D Received: from cascais.lan (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 34A1B182CA for ; Tue, 6 Jun 2017 14:55:31 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [pushed] Fix double free when running gdb.linespec/ls-errs.exp (PR breakpoints/21553) Date: Tue, 06 Jun 2017 14:55:00 -0000 Message-Id: <1496760930-25011-1-git-send-email-palves@redhat.com> X-SW-Source: 2017-06/txt/msg00147.txt.bz2 Content-length: 14065 The problem is that b->extra_string is free'ed twice: Once in the breakpoint's dtor, and another time via make_cleanup (xfree). This patch gets rid of the cleanups, fixing the problem. Tested on x86_64 GNU/Linux. gdb/ChangeLog: 2017-06-06 Pedro Alves PR breakpoints/21553 * breakpoint.c (create_breakpoints_sal_default) (init_breakpoint_sal, create_breakpoint_sal): Use gdb::unique_xmalloc_ptr for string parameters. (create_breakpoint): Constify 'extra_string' and 'cond_string' parameters. Replace cleanups with gdb::unique_xmalloc_ptr. (base_breakpoint_create_breakpoints_sal) (bkpt_create_breakpoints_sal, tracepoint_create_breakpoints_sal) (strace_marker_create_breakpoints_sal) (create_breakpoints_sal_default): Use gdb::unique_xmalloc_ptr for string parameters. * breakpoint.h (breakpoint_ops::create_breakpoints_sal): Use gdb::unique_xmalloc_ptr for string parameters. (create_breakpoint): Constify 'extra_string' and 'cond_string' parameters. --- gdb/ChangeLog | 18 +++++++++ gdb/breakpoint.c | 119 +++++++++++++++++++++++++++---------------------------- gdb/breakpoint.h | 7 ++-- 3 files changed, 80 insertions(+), 64 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 319e9c4..0073122 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,21 @@ +2017-06-06 Pedro Alves + + PR breakpoints/21553 + * breakpoint.c (create_breakpoints_sal_default) + (init_breakpoint_sal, create_breakpoint_sal): Use + gdb::unique_xmalloc_ptr for string parameters. + (create_breakpoint): Constify 'extra_string' and 'cond_string' + parameters. Replace cleanups with gdb::unique_xmalloc_ptr. + (base_breakpoint_create_breakpoints_sal) + (bkpt_create_breakpoints_sal, tracepoint_create_breakpoints_sal) + (strace_marker_create_breakpoints_sal) + (create_breakpoints_sal_default): Use gdb::unique_xmalloc_ptr for + string parameters. + * breakpoint.h (breakpoint_ops::create_breakpoints_sal): Use + gdb::unique_xmalloc_ptr for string parameters. + (create_breakpoint): Constify 'extra_string' and 'cond_string' + parameters. + 2017-06-06 Alan Hayward * alpha-tdep.c (alpha_register_to_value): Use diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 0dc9841..e84d164 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -120,7 +120,9 @@ static void static void create_breakpoints_sal_default (struct gdbarch *, struct linespec_result *, - char *, char *, enum bptype, + gdb::unique_xmalloc_ptr, + gdb::unique_xmalloc_ptr, + enum bptype, enum bpdisp, int, int, int, const struct breakpoint_ops *, @@ -9167,8 +9169,9 @@ static void init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch, struct symtabs_and_lines sals, event_location_up &&location, - char *filter, char *cond_string, - char *extra_string, + gdb::unique_xmalloc_ptr filter, + gdb::unique_xmalloc_ptr cond_string, + gdb::unique_xmalloc_ptr extra_string, enum bptype type, enum bpdisp disposition, int thread, int task, int ignore_count, const struct breakpoint_ops *ops, int from_tty, @@ -9214,8 +9217,8 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch, b->thread = thread; b->task = task; - b->cond_string = cond_string; - b->extra_string = extra_string; + b->cond_string = cond_string.release (); + b->extra_string = extra_string.release (); b->ignore_count = ignore_count; b->enable_state = enabled ? bp_enabled : bp_disabled; b->disposition = disposition; @@ -9299,15 +9302,16 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch, b->location = std::move (location); else b->location = new_address_location (b->loc->address, NULL, 0); - b->filter = filter; + b->filter = filter.release (); } static void create_breakpoint_sal (struct gdbarch *gdbarch, struct symtabs_and_lines sals, event_location_up &&location, - char *filter, char *cond_string, - char *extra_string, + gdb::unique_xmalloc_ptr filter, + gdb::unique_xmalloc_ptr cond_string, + gdb::unique_xmalloc_ptr extra_string, enum bptype type, enum bpdisp disposition, int thread, int task, int ignore_count, const struct breakpoint_ops *ops, int from_tty, @@ -9318,7 +9322,9 @@ create_breakpoint_sal (struct gdbarch *gdbarch, init_breakpoint_sal (b.get (), gdbarch, sals, std::move (location), - filter, cond_string, extra_string, + std::move (filter), + std::move (cond_string), + std::move (extra_string), type, disposition, thread, task, ignore_count, ops, from_tty, @@ -9346,7 +9352,8 @@ create_breakpoint_sal (struct gdbarch *gdbarch, static void create_breakpoints_sal (struct gdbarch *gdbarch, struct linespec_result *canonical, - char *cond_string, char *extra_string, + gdb::unique_xmalloc_ptr cond_string, + gdb::unique_xmalloc_ptr extra_string, enum bptype type, enum bpdisp disposition, int thread, int task, int ignore_count, const struct breakpoint_ops *ops, int from_tty, @@ -9365,13 +9372,14 @@ create_breakpoints_sal (struct gdbarch *gdbarch, event_location_up location = (canonical->location != NULL ? copy_event_location (canonical->location.get ()) : NULL); - char *filter_string = lsal->canonical ? xstrdup (lsal->canonical) : NULL; + gdb::unique_xmalloc_ptr filter_string + (lsal->canonical != NULL ? xstrdup (lsal->canonical) : NULL); - make_cleanup (xfree, filter_string); create_breakpoint_sal (gdbarch, lsal->sals, std::move (location), - filter_string, - cond_string, extra_string, + std::move (filter_string), + std::move (cond_string), + std::move (extra_string), type, disposition, thread, task, ignore_count, ops, from_tty, enabled, internal, flags, @@ -9650,8 +9658,9 @@ decode_static_tracepoint_spec (const char **arg_p) int create_breakpoint (struct gdbarch *gdbarch, - const struct event_location *location, char *cond_string, - int thread, char *extra_string, + const struct event_location *location, + const char *cond_string, + int thread, const char *extra_string, int parse_extra, int tempflag, enum bptype type_wanted, int ignore_count, @@ -9743,9 +9752,13 @@ create_breakpoint (struct gdbarch *gdbarch, breakpoint. */ if (!pending) { + gdb::unique_xmalloc_ptr cond_string_copy; + gdb::unique_xmalloc_ptr extra_string_copy; + if (parse_extra) { char *rest; + char *cond; struct linespec_sals *lsal; lsal = VEC_index (linespec_sals, canonical.sals, 0); @@ -9756,15 +9769,9 @@ create_breakpoint (struct gdbarch *gdbarch, re-parse it in context of each sal. */ find_condition_and_thread (extra_string, lsal->sals.sals[0].pc, - &cond_string, &thread, &task, &rest); - if (cond_string) - make_cleanup (xfree, cond_string); - if (rest) - make_cleanup (xfree, rest); - if (rest) - extra_string = rest; - else - extra_string = NULL; + &cond, &thread, &task, &rest); + cond_string_copy.reset (cond); + extra_string_copy.reset (rest); } else { @@ -9774,20 +9781,16 @@ create_breakpoint (struct gdbarch *gdbarch, /* Create a private copy of condition string. */ if (cond_string) - { - cond_string = xstrdup (cond_string); - make_cleanup (xfree, cond_string); - } + cond_string_copy.reset (xstrdup (cond_string)); /* Create a private copy of any extra string. */ if (extra_string) - { - extra_string = xstrdup (extra_string); - make_cleanup (xfree, extra_string); - } + extra_string_copy.reset (xstrdup (extra_string)); } ops->create_breakpoints_sal (gdbarch, &canonical, - cond_string, extra_string, type_wanted, + std::move (cond_string_copy), + std::move (extra_string_copy), + type_wanted, tempflag ? disp_del : disp_donttouch, thread, task, ignore_count, ops, from_tty, enabled, internal, flags); @@ -9804,22 +9807,12 @@ create_breakpoint (struct gdbarch *gdbarch, else { /* Create a private copy of condition string. */ - if (cond_string) - { - cond_string = xstrdup (cond_string); - make_cleanup (xfree, cond_string); - } - b->cond_string = cond_string; + b->cond_string = cond_string != NULL ? xstrdup (cond_string) : NULL; b->thread = thread; } /* Create a private copy of any extra string. */ - if (extra_string != NULL) - { - extra_string = xstrdup (extra_string); - make_cleanup (xfree, extra_string); - } - b->extra_string = extra_string; + b->extra_string = extra_string != NULL ? xstrdup (extra_string) : NULL; b->ignore_count = ignore_count; b->disposition = tempflag ? disp_del : disp_donttouch; b->condition_not_parsed = 1; @@ -12839,8 +12832,8 @@ base_breakpoint_create_sals_from_location static void base_breakpoint_create_breakpoints_sal (struct gdbarch *gdbarch, struct linespec_result *c, - char *cond_string, - char *extra_string, + gdb::unique_xmalloc_ptr cond_string, + gdb::unique_xmalloc_ptr extra_string, enum bptype type_wanted, enum bpdisp disposition, int thread, @@ -13088,8 +13081,8 @@ bkpt_create_sals_from_location (const struct event_location *location, static void bkpt_create_breakpoints_sal (struct gdbarch *gdbarch, struct linespec_result *canonical, - char *cond_string, - char *extra_string, + gdb::unique_xmalloc_ptr cond_string, + gdb::unique_xmalloc_ptr extra_string, enum bptype type_wanted, enum bpdisp disposition, int thread, @@ -13099,7 +13092,8 @@ bkpt_create_breakpoints_sal (struct gdbarch *gdbarch, int internal, unsigned flags) { create_breakpoints_sal_default (gdbarch, canonical, - cond_string, extra_string, + std::move (cond_string), + std::move (extra_string), type_wanted, disposition, thread, task, ignore_count, ops, from_tty, @@ -13407,8 +13401,8 @@ tracepoint_create_sals_from_location (const struct event_location *location, static void tracepoint_create_breakpoints_sal (struct gdbarch *gdbarch, struct linespec_result *canonical, - char *cond_string, - char *extra_string, + gdb::unique_xmalloc_ptr cond_string, + gdb::unique_xmalloc_ptr extra_string, enum bptype type_wanted, enum bpdisp disposition, int thread, @@ -13418,7 +13412,8 @@ tracepoint_create_breakpoints_sal (struct gdbarch *gdbarch, int internal, unsigned flags) { create_breakpoints_sal_default (gdbarch, canonical, - cond_string, extra_string, + std::move (cond_string), + std::move (extra_string), type_wanted, disposition, thread, task, ignore_count, ops, from_tty, @@ -13563,8 +13558,8 @@ strace_marker_create_sals_from_location (const struct event_location *location, static void strace_marker_create_breakpoints_sal (struct gdbarch *gdbarch, struct linespec_result *canonical, - char *cond_string, - char *extra_string, + gdb::unique_xmalloc_ptr cond_string, + gdb::unique_xmalloc_ptr extra_string, enum bptype type_wanted, enum bpdisp disposition, int thread, @@ -13598,7 +13593,8 @@ strace_marker_create_breakpoints_sal (struct gdbarch *gdbarch, tp = new tracepoint (); init_breakpoint_sal (tp, gdbarch, expanded, std::move (location), NULL, - cond_string, extra_string, + std::move (cond_string), + std::move (extra_string), type_wanted, disposition, thread, task, ignore_count, ops, from_tty, enabled, internal, flags, @@ -14351,8 +14347,8 @@ create_sals_from_location_default (const struct event_location *location, static void create_breakpoints_sal_default (struct gdbarch *gdbarch, struct linespec_result *canonical, - char *cond_string, - char *extra_string, + gdb::unique_xmalloc_ptr cond_string, + gdb::unique_xmalloc_ptr extra_string, enum bptype type_wanted, enum bpdisp disposition, int thread, @@ -14361,8 +14357,9 @@ create_breakpoints_sal_default (struct gdbarch *gdbarch, int from_tty, int enabled, int internal, unsigned flags) { - create_breakpoints_sal (gdbarch, canonical, cond_string, - extra_string, + create_breakpoints_sal (gdbarch, canonical, + std::move (cond_string), + std::move (extra_string), type_wanted, disposition, thread, task, ignore_count, ops, from_tty, enabled, internal, flags); diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 848d2c6..d955184 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -604,7 +604,8 @@ struct breakpoint_ops This function is called inside `create_breakpoint'. */ void (*create_breakpoints_sal) (struct gdbarch *, struct linespec_result *, - char *, char *, + gdb::unique_xmalloc_ptr, + gdb::unique_xmalloc_ptr, enum bptype, enum bpdisp, int, int, int, const struct breakpoint_ops *, int, int, int, unsigned); @@ -1329,8 +1330,8 @@ enum breakpoint_create_flags extern int create_breakpoint (struct gdbarch *gdbarch, const struct event_location *location, - char *cond_string, int thread, - char *extra_string, + const char *cond_string, int thread, + const char *extra_string, int parse_extra, int tempflag, enum bptype wanted_type, int ignore_count, -- 2.5.5