Message ID | 20230125200626.29340-1-tdevries@suse.de |
---|---|
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AFE8D3858031 for <patchwork@sourceware.org>; Wed, 25 Jan 2023 20:06:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AFE8D3858031 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1674677211; bh=jWodKshpncDUo2ZZUYr2KDoEeajwfY8PJKYEiptXL6E=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=hMNLGaSrcf8yfVUE/sg1FteSbBXfk7M4EaQdRtvAbbab1JaXKDat5sm6SFE6cOz+u fVbZxwYIRXHYYue+yTF3486XZQOeKRWHfgZ1ipsSB/ACRLniXSTHhTlthceib+eZoe S/E0cRUBNhwKufQzzjzE1BGc4HgUPJwPAxqMKxCo= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 699303858C00 for <gdb-patches@sourceware.org>; Wed, 25 Jan 2023 20:06:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 699303858C00 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 19B411FE94; Wed, 25 Jan 2023 20:06:27 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id EA9541339E; Wed, 25 Jan 2023 20:06:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id CesIOMKL0WPmeAAAMHmgww (envelope-from <tdevries@suse.de>); Wed, 25 Jan 2023 20:06:26 +0000 To: gdb-patches@sourceware.org Cc: Tom Tromey <tom@tromey.com> Subject: [RFC 0/3] [gdb/testsuite] Introduce is_x86_64_m64_target Date: Wed, 25 Jan 2023 21:06:23 +0100 Message-Id: <20230125200626.29340-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> From: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> Reply-To: Tom de Vries <tdevries@suse.de> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
Introduce is_x86_64_m64_target
|
|
Message
Tom de Vries
Jan. 25, 2023, 8:06 p.m. UTC
I used a refactoring setup I wrote in python for another refactoring to rewrite: ... if { ![istarget x86_64-*-* ] || ![is_lp64_target] } { verbose "Skipping ${testfile}." return } ... into: ... require is_x86_64_m64_target ... It also handles the elseif case. Due to a recent commit, only the elseif cases are transformed, the others have been handled already. Also, I see now that "require {istarget x86_64-*-*} is_lp64_target" can be used, and that is_x86_64_m64_target not stricly necessary. I've included the two patches with the refactoring scripts. Tom de Vries (3): [gdb/contrib] Add refactor.py [gdb/contrib] Add refactor_require.py [gdb/testsuite] Add and use is_x86_64_m64_target gdb/contrib/refactor.py | 73 +++++++++++++++++++ gdb/contrib/refactor_require.py | 53 ++++++++++++++ .../gdb.arch/amd64-entry-value-param.exp | 5 +- gdb/testsuite/gdb.arch/amd64-tailcall-ret.exp | 5 +- .../gdb.mi/mi2-amd64-entry-value.exp | 5 +- .../gdb.python/py-framefilter-invalidarg.exp | 5 +- gdb/testsuite/gdb.python/py-linetable.exp | 5 +- .../gdb.reverse/amd64-tailcall-reverse.exp | 5 +- .../gdb.reverse/singlejmp-reverse.exp | 5 +- gdb/testsuite/lib/gdb.exp | 4 + 10 files changed, 143 insertions(+), 22 deletions(-) create mode 100755 gdb/contrib/refactor.py create mode 100644 gdb/contrib/refactor_require.py base-commit: 6121eeb72978cc5749c4c9f119b4dbaf637517c9
Comments
>>>>> "Tom" == Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> writes:
Tom> I used a refactoring setup I wrote in python for another refactoring to
Tom> rewrite:
Tom> ...
Tom> if { ![istarget x86_64-*-* ] || ![is_lp64_target] } {
Tom> verbose "Skipping ${testfile}."
Tom> return
Tom> }
Tom> ...
Tom> into:
Tom> ...
Tom> require is_x86_64_m64_target
Tom> ...
Tom> It also handles the elseif case.
Tom> Due to a recent commit, only the elseif cases are transformed, the others
Tom> have been handled already.
If you want the existing requires could be converted to use the new
proc. Seems a little simpler.
I sent a comment to one patch but otherwise this looks good to me.
Thanks for doing it.
FWIW I also have some refactoring scripts, but mine are
idiosyncratically written in emacs lisp, which is convenient in some
ways (easier to do multi-line edits, and back in the day I could have
them make ChangeLog entries) but worse in others (slow).
Tom
On 1/25/23 22:26, Tom Tromey wrote: >>>>>> "Tom" == Tom de Vries via Gdb-patches <gdb-patches@sourceware.org> writes: > > Tom> I used a refactoring setup I wrote in python for another refactoring to > Tom> rewrite: > Tom> ... > Tom> if { ![istarget x86_64-*-* ] || ![is_lp64_target] } { > Tom> verbose "Skipping ${testfile}." > Tom> return > Tom> } > Tom> ... > Tom> into: > Tom> ... > Tom> require is_x86_64_m64_target > Tom> ... > > Tom> It also handles the elseif case. > > Tom> Due to a recent commit, only the elseif cases are transformed, the others > Tom> have been handled already. > > If you want the existing requires could be converted to use the new > proc. Seems a little simpler. > Done. > I sent a comment to one patch but otherwise this looks good to me. > Thanks for doing it. > > FWIW I also have some refactoring scripts, but mine are > idiosyncratically written in emacs lisp, which is convenient in some > ways (easier to do multi-line edits, and back in the day I could have > them make ChangeLog entries) but worse in others (slow). I see. I love to use emacs, but I'm not familiar with lisp, so that's not an option for me :) Anyway, I don't think that the refactoring scripts I've posted here are ready for contribution, but ideally I'd love to have some refactoring tool commonly used, with the idea that it would enable not only posting the result of the transformation, put also the transformation itself, and you could get feedback on the transformation, people could try it out themselves, find cases they think could be handled in addition, post improved versions. And something in python seems not a bad choice, considering the popularity of it. FWIW, I've started out with the idea of using cocinelle for some gdb source transformation, but pretty soon found out that c++ support is missing/poor, so I abandoned that idea. Thanks, - Tom