From patchwork Sat Nov 19 18:43:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Brobecker X-Patchwork-Id: 83135 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp711292qge; Sat, 19 Nov 2016 10:43:46 -0800 (PST) X-Received: by 10.129.120.215 with SMTP id t206mr6115396ywc.39.1479581026276; Sat, 19 Nov 2016 10:43:46 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 63si2975772ybo.218.2016.11.19.10.43.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Nov 2016 10:43:46 -0800 (PST) Received-SPF: pass (google.com: domain of gdb-patches-return-134993-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of gdb-patches-return-134993-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gdb-patches-return-134993-patch=linaro.org@sourceware.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:in-reply-to; q=dns; s=default; b=FsfN a1+FHLmk6Ms6Gs7Z8KPqmAXpmOYooI9PTl9O0/jCOhFsT+XcQl56bgjv5TWMyYl6 ME4+i/5jfusOUQ7aIjzt960Nzvt0uI6JJ+L6i9MkWQK9F+yqKuQ6d0bhHvTpp3yr 7E5I5siM6EDM2CbgKjzyUj+JrCgHZPsbkRPJoyw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:cc:subject:message-id:references :mime-version:content-type:in-reply-to; s=default; bh=A+D6VTjPwE XQ4Qmv9j43CazRAoE=; b=q4n7Wvy8Y0ACjMTT1+1ejYeuAxURKlpD7pbK/RezvW VIn+Zk7o4vOOZgEVmasXcnEP+oUoaM9DcxeOyflpXAGGeyzNmQddRmgtwsI2jsM2 hlM6NN6Syb2NSycahuR8HP5lejUK3EjUlFuvY7ztfApzkURPZWi9Vn6vGcFKO6PD A= Received: (qmail 37735 invoked by alias); 19 Nov 2016 18:43:37 -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 37714 invoked by uid 89); 19 Nov 2016 18:43:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=BEGIN, contrib, tracepoint.c, tracepointh X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 19 Nov 2016 18:43:25 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 4F9C11165E9; Sat, 19 Nov 2016 13:43:24 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id usCrTh3+i63v; Sat, 19 Nov 2016 13:43:24 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 1F0C6116541; Sat, 19 Nov 2016 13:43:24 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 9532C424D8; Sat, 19 Nov 2016 10:43:22 -0800 (PST) Date: Sat, 19 Nov 2016 10:43:22 -0800 From: Joel Brobecker To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: [FYI/pushed] ARI: Add detection of printf_vma and sprintf_vma (was: "Re: [PATCH] gdb/tracepoint.c: Don't use printf_vma") Message-ID: <20161119184322.GD4132@adacore.com> References: <1479251441-16443-1-git-send-email-palves@redhat.com> <20161116235831.GA4132@adacore.com> <1a578b5a-608e-b75e-7a68-687bae3c1aa8@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1a578b5a-608e-b75e-7a68-687bae3c1aa8@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) > >> gdb/ChangeLog: > >> yyyy-mm-dd Pedro Alves > >> > >> * tracepoint.c (collection_list::add_memrange): Add gdbarch > >> parameter. Use paddress instead of printf_vma. Adjust recursive > >> calls. > >> (collection_list::stringify): Use paddress and phex_nz instead of > >> sprintf_vma. Adjust add_memrange call. > >> * tracepoint.h (collection_list::add_memrange): Declare new method. > > > > How about adding an ARI rule for those? I think it would help > > avoid this function creeping back in. > > Indeed, sounds like a good idea. Thanks! I just pushed the attached patch to master. gdb/ChangeLog: * contrib/ari/gdb_ari.sh: Add detection of printf_vma and sprintf_vma. -- Joel >From cc188e5fd6d4f8d3061ed6c58c432a150f7966e9 Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Sat, 19 Nov 2016 10:40:17 -0800 Subject: [PATCH] ARI: Add detection of printf_vma and sprintf_vma We shouldn't be using these, since their output goes straight to stdout, which doesn't allow redirection. So this patch updates the ARI to detect any such use. gdb/ChangeLog: * contrib/ari/gdb_ari.sh: Add detection of printf_vma and sprintf_vma. --- gdb/ChangeLog | 5 +++++ gdb/contrib/ari/gdb_ari.sh | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 07d21a6..3797e8b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2016-11-19 Joel Brobecker + + * contrib/ari/gdb_ari.sh: Add detection of printf_vma and + sprintf_vma. + 2016-11-18 Simon Marchi * Makefile.in (%.o: $(srcdir)/gdbtk/generic/%.c): Fix typo. diff --git a/gdb/contrib/ari/gdb_ari.sh b/gdb/contrib/ari/gdb_ari.sh index 7e639e3..2ecc0d6 100755 --- a/gdb/contrib/ari/gdb_ari.sh +++ b/gdb/contrib/ari/gdb_ari.sh @@ -1097,6 +1097,22 @@ Do not use vasprintf(), instead use xstrvprintf" fail("vasprintf") } +BEGIN { doc["printf_vma"] = "\ +Do not use printf_vma, instead use paddress or phex_nz" + category["printf_vma"] = ari_code +} +/(^|[^_[:alnum:]])printf_vma[[:space:]]*\(/ { + fail("printf_vma") +} + +BEGIN { doc["sprintf_vma"] = "\ +Do not use sprintf_vma, instead use paddress or phex_nz" + category["sprintf_vma"] = ari_code +} +/(^|[^_[:alnum:]])sprintf_vma[[:space:]]*\(/ { + fail("sprintf_vma") +} + # More generic memory operations BEGIN { doc["bzero"] = "\ -- 2.5.0