From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5098 invoked by alias); 17 Apr 2010 10:58:24 -0000 Received: (qmail 5087 invoked by uid 22791); 17 Apr 2010 10:58:23 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 17 Apr 2010 10:58:19 +0000 Received: (qmail 24088 invoked from network); 17 Apr 2010 10:58:15 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 17 Apr 2010 10:58:15 -0000 From: Pedro Alves To: "Pierre Muller" Subject: Re: [RFC] Mingw Windows 64-bit gdbserver Date: Sat, 17 Apr 2010 10:58:00 -0000 User-Agent: KMail/1.12.2 (Linux/2.6.31-20-generic; KDE/4.3.2; x86_64; ; ) Cc: gdb-patches@sourceware.org References: <000d01cadd79$efa9e2b0$cefda810$@muller@ics-cnrs.unistra.fr> <201004161659.37990.pedro@codesourcery.com> <001f01caddf0$6d4246b0$47c6d410$@muller@ics-cnrs.unistra.fr> In-Reply-To: <001f01caddf0$6d4246b0$47c6d410$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201004171158.08327.pedro@codesourcery.com> X-IsSubscribed: yes 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 X-SW-Source: 2010-04/txt/msg00527.txt.bz2 On Saturday 17 April 2010 06:40:02, Pierre Muller wrote: > > How about instead merging the files, like > > linux-x86-low.c handles both 64-bit and 32-bit? There's > > a lot of common stuff between both archs support, it > > seems. > > Of course, I agree with you that the two files > share a very large common portion that is identical. > There are only two places where they really differ: > For the call to the init_registers_XXX > and for the register mappings array. > > The main question is how should we split these parts > off if we want to keep a common part: > > I would propose this: > rename win32-i386-low.c to win-x86-low.c Lets avoid someone reading this and getting religious against "win", and go with windows-*-low.c, just like gdb/windows-nat.c was renamed from win32-nat.c, and gdb has i386-windows-nat.c and amd64-windows-nat.c. > Create win32-i386-low.h and win64-amd64-low.h > that would have the register mappings and > a macro to define their local init_registers. Yes, much better, if nothing else because that's how gdb handles this as well. It's always good to have the code bases solve the same problem in the same way, so that we can more easily keep them in sync or merge them. Take a look at gdb/amd64-windows-nat.c, it also does something similar to handle the common stuff, though since we have a win32_target_ops in gdbserver, we can put the register mappings array pointer directly in win32_target_ops instead of making it a global. Let's avoid macros. Use for example the `arch_setup' callback in the win32_target_ops vector for this, keeping the arrays defined in the corresponding arch specific .c files. -- Pedro Alves