From patchwork Sat Apr 14 19:09:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 26709 Received: (qmail 122480 invoked by alias); 14 Apr 2018 19:10:00 -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 122425 invoked by uid 89); 14 Apr 2018 19:09:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.4 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=METHOD, Trim, target_ops X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 14 Apr 2018 19:09:58 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 242084075386 for ; Sat, 14 Apr 2018 19:09:57 +0000 (UTC) Received: from localhost.localdomain (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9E6C215CDC8 for ; Sat, 14 Apr 2018 19:09:56 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 02/40] make-target-delegates: line break between return type and function name Date: Sat, 14 Apr 2018 20:09:15 +0100 Message-Id: <20180414190953.24481-3-palves@redhat.com> In-Reply-To: <20180414190953.24481-1-palves@redhat.com> References: <20180414190953.24481-1-palves@redhat.com> Before the target_ops C++ification, this wasn't necessary simply because the methods were wrapped in ()'s, like '(*to_my_long_method_name) (target_ops *)', so std::vector(*to_my_long_method_name) ()TARGET_DEFAULT_IGNORE () still parsed correctly. With the (*) gone, we need this. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * make-target-delegates (scan_target_h): Don't trim lines here. Replace sequences of tabs and/or whitespace with a single whitespace. (top level, parsing methods): Trim each line before processing it here. --- gdb/make-target-delegates | 20 +++++++++++++++++++- gdb/target.h | 3 ++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/gdb/make-target-delegates b/gdb/make-target-delegates index 10853e3e20..83a1afcadf 100755 --- a/gdb/make-target-delegates +++ b/gdb/make-target-delegates @@ -102,7 +102,6 @@ sub scan_target_h() { # Strip // comments. $_ =~ s,//.*$,,; - $_ = trim ($_); $all_the_text .= $_; } @@ -110,6 +109,21 @@ sub scan_target_h() { # Now strip out the C comments. $all_the_text =~ s,/\*(.*?)\*/,,g; + # Replace sequences of tabs and/or whitespace with a single + # whitespace character. We need the whitespace because the method + # may have been split between multiple lines, like e.g.: + # + # virtual std::vector + # my_long_method_name () + # TARGET_DEFAULT_IGNORE (); + # + # If we didn't preserve the whitespace, then we'd end up with: + # + # virtual std::vectormy_long_method_name ()TARGET_DEFAULT_IGNORE () + # + # ... which wouldn't later be parsed correctly. + $all_the_text =~ s/[\t\s]+/ /g; + return split (/;/, $all_the_text); } @@ -348,6 +362,10 @@ print "\n"; @argtypes_array = (); foreach $current_line (@lines) { + # See comments in scan_target_h. Here we strip away the leading + # and trailing whitespace. + $current_line = trim ($current_line); + next unless $current_line =~ m/$METHOD/; my $name = $+{name}; diff --git a/gdb/target.h b/gdb/target.h index b23b7625be..f78eb459dc 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1067,7 +1067,8 @@ struct target_ops /* Return a vector of all tracepoints markers string id ID, or all markers if ID is NULL. */ - virtual std::vector static_tracepoint_markers_by_strid (const char *id) + virtual std::vector + static_tracepoint_markers_by_strid (const char *id) TARGET_DEFAULT_NORETURN (tcomplain ()); /* Return a traceframe info object describing the current