From patchwork Mon Aug 6 20:58:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 28765 Received: (qmail 95737 invoked by alias); 6 Aug 2018 20:59:18 -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 95724 invoked by uid 89); 6 Aug 2018 20:59:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.7 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= X-HELO: sesbmg22.ericsson.net Received: from sesbmg22.ericsson.net (HELO sesbmg22.ericsson.net) (193.180.251.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 06 Aug 2018 20:59:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/simple; q=dns/txt; i=@ericsson.com; t=1533589153; h=From:Sender:Reply-To:Subject:Date:Message-Id:To:CC:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=sitCt0eMckcLknUu9xd/YtDg59wfIx7F/arxD6Azeaw=; b=Heu8y4TaApofIAVc82xzNZ9mBJH1KYAl+ncVqkUHvkh1oUtyrytWGzneDdwyPbs/ reiUHsZDHiY/iO4DMXXm74G5SsVVL+aGwUNr4fyl7joZ1snN904bGcvoyzoxCpmN C03Wr2fa1iN/ijj9kjhT8MdQ+XxKcQ3U6vi3wxx7V9I=; Received: from ESESBMB504.ericsson.se (Unknown_Domain [153.88.183.117]) by sesbmg22.ericsson.net (Symantec Mail Security) with SMTP id 44.53.21978.1A6B86B5; Mon, 6 Aug 2018 22:59:13 +0200 (CEST) Received: from ESESSMR505.ericsson.se (153.88.183.127) by ESESBMB504.ericsson.se (153.88.183.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Mon, 6 Aug 2018 22:59:12 +0200 Received: from ESESBMB505.ericsson.se (153.88.183.172) by ESESSMR505.ericsson.se (153.88.183.127) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Mon, 6 Aug 2018 22:59:12 +0200 Received: from NAM01-BY2-obe.outbound.protection.outlook.com (153.88.183.157) by ESESBMB505.ericsson.se (153.88.183.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3 via Frontend Transport; Mon, 6 Aug 2018 22:59:12 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LZ1AwUZXKM8ohYuFKXHYVzoUwy/JotuzD0VwIP/83rQ=; b=EMm74hOl+e01Lldk+YdaCVOV7WJwKr5BEma9zuX7jNZG8NesgEeojcAo8y5ANDh+1oUcZgKOdK9JoYpG3HWztWsrMu7YtSflJYuUqP2gj30JV8mkF596jr8LxWLeNqglSroj8a0rCB+Ys9zJSgW8VGp41pQTH1zrdxXg2NpkVQ8= 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 DM6PR15MB2395.namprd15.prod.outlook.com (2603:10b6:5:8d::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Mon, 6 Aug 2018 20:59:09 +0000 From: Simon Marchi To: CC: Simon Marchi Subject: [pushed] Fix compilation failure in remote.c Date: Mon, 6 Aug 2018 16:58:51 -0400 Message-Id: <1533589131-30320-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 Return-Path: simon.marchi@ericsson.com Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-IsSubscribed: yes A recent patch introduced a few of these: /home/emaisin/src/binutils-gdb/gdb/remote.c:12862:19: error: format not a string literal and no format arguments [-Werror=format-security] error (err_msg); ^ Fix them by replacing the call to error with error ("%s", err_msg); gdb/ChangeLog: * remote.c (remote_target::download_tracepoint): Fix format string errors. --- gdb/ChangeLog | 5 +++++ gdb/remote.c | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 03badaf..8fc9cab 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2018-08-06 Simon Marchi + + * remote.c (remote_target::download_tracepoint): Fix format + string errors. + 2018-08-06 Pedro Franco de Carvalho * tracefile.c: Include common/byte-vector.h. diff --git a/gdb/remote.c b/gdb/remote.c index 4974c2e..33f6cd5 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -12859,7 +12859,7 @@ remote_target::download_tracepoint (struct bp_location *loc) t->step_count, t->pass_count); if (ret < 0 || ret >= buf.size ()) - error (err_msg); + error ("%s", err_msg); /* Fast tracepoints are mostly handled by the target, but we can tell the target how big of an instruction block should be moved @@ -12879,7 +12879,7 @@ remote_target::download_tracepoint (struct bp_location *loc) gdb_insn_length (loc->gdbarch, tpaddr)); if (ret < 0 || ret >= size_left) - error (err_msg); + error ("%s", err_msg); } else /* If it passed validation at definition but fails now, @@ -12910,7 +12910,7 @@ remote_target::download_tracepoint (struct bp_location *loc) size_left, ":S"); if (ret < 0 || ret >= size_left) - error (err_msg); + error ("%s", err_msg); } else error (_("Static tracepoint not valid during download")); @@ -12938,14 +12938,14 @@ remote_target::download_tracepoint (struct bp_location *loc) size_left, ":X%x,", aexpr->len); if (ret < 0 || ret >= size_left) - error (err_msg); + error ("%s", err_msg); size_left = buf.size () - strlen (buf.data ()); /* Two bytes to encode each aexpr byte, plus the terminating null byte. */ if (aexpr->len * 2 + 1 > size_left) - error (err_msg); + error ("%s", err_msg); pkt = buf.data () + strlen (buf.data ()); @@ -12966,7 +12966,7 @@ remote_target::download_tracepoint (struct bp_location *loc) size_left, "-"); if (ret < 0 || ret >= size_left) - error (err_msg); + error ("%s", err_msg); } putpkt (buf.data ()); @@ -12989,7 +12989,7 @@ remote_target::download_tracepoint (struct bp_location *loc) has_more ? '-' : 0); if (ret < 0 || ret >= buf.size ()) - error (err_msg); + error ("%s", err_msg); putpkt (buf.data ()); remote_get_noisy_reply (); @@ -13012,7 +13012,7 @@ remote_target::download_tracepoint (struct bp_location *loc) has_more ? "-" : ""); if (ret < 0 || ret >= buf.size ()) - error (err_msg); + error ("%s", err_msg); putpkt (buf.data ()); remote_get_noisy_reply (); @@ -13027,7 +13027,7 @@ remote_target::download_tracepoint (struct bp_location *loc) ret = snprintf (buf.data (), buf.size (), "QTDPsrc:"); if (ret < 0 || ret >= buf.size ()) - error (err_msg); + error ("%s", err_msg); encode_source_string (b->number, loc->address, "at", event_location_to_string (b->location.get ()), @@ -13043,7 +13043,7 @@ remote_target::download_tracepoint (struct bp_location *loc) ret = snprintf (buf.data (), buf.size (), "QTDPsrc:"); if (ret < 0 || ret >= buf.size ()) - error (err_msg); + error ("%s", err_msg); encode_source_string (b->number, loc->address, "cond", b->cond_string,