[RFC] Mingw Windows 64-bit gdbserver

Pedro Alves pedro@codesourcery.com
Sat Apr 17 10:58:00 GMT 2010


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



More information about the Gdb-patches mailing list