This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: some news about the x86_64-windows port...


> Date: Wed, 7 Jan 2009 14:58:48 +0400
> From: Joel Brobecker <brobecker@adacore.com>
> 
>   context_offset (FloatSave.ErrorSelector),
>   context_offset (FloatSave.ErrorOffset),
>   context_offset (FloatSave.DataSelector),
>   context_offset (FloatSave.DataOffset),
>   context_offset (FloatSave.ErrorSelector)
> 
> These entries are supposed to be the offset of the following
> registers in the CONTEXT structure:
> 
>   "fiseg", "fioff", "foseg", "fooff", "fop",
> 
> I couldn't find what these registers are about, so I cheated and
> used the sources that Kai sent me. I have no idea whether this
> is correct or not.

These registers are part of the FPU state, and set whenever a
floating-point exception happens.  Judging from the names that bit of
code is right.  And it would be very hard to claim copyright over
those five lines, so I wouldn't worry too much about issues there.

> +++ b/gdb/amd64-windows-tdep.c
> @@ -0,0 +1,41 @@
> +/* Copyright (C) 2009 Free Software Foundation, Inc.
> +
> +   This file is part of GDB.
> +
> +   This program is free software; you can redistribute it and/or modify
> +   it under the terms of the GNU General Public License as published by
> +   the Free Software Foundation; either version 3 of the License, or
> +   (at your option) any later version.
> +
> +   This program is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +   GNU General Public License for more details.
> +
> +   You should have received a copy of the GNU General Public License
> +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
> +
> +#include "defs.h"
> +#include "osabi.h"
> +#include "amd64-tdep.h"
> +#include "solib.h"
> +#include "solib-target.h"
> +
> +static void
> +amd64_windows_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
> +{
> +  amd64_init_abi (info, gdbarch);
> +
> +  /* On Windows, "long"s are only 32bit.  */
> +  set_gdbarch_long_bit (gdbarch, 32);

I wouldn't mind a comment how utterly retarded the choice made by
Microsoft is ;).

> index bceba76..1badecf 100644
> --- a/gdb/config.in
> +++ b/gdb/config.in
> @@ -175,6 +175,9 @@
>  /* Define to 1 if you have the <inttypes.h> header file. */
>  #undef HAVE_INTTYPES_H
>  
> +/* Define to 1 if you have the `kill' function. */
> +#undef HAVE_KILL
> +

See my comment below.

> +/* Define to 1 if host is LLP64 (pointers is 64bits and "long" is32bits) */
> +#undef HOST_IS_LLP64

I think there are more elegant ways to handle Microsoft's retarded
"64-bit" ABI.

> --- /dev/null
> +++ b/gdb/config/i386/nm-cygwin64.h
> @@ -0,0 +1,36 @@
> +/* Copyright 2008, 2009 Free Software Foundation, Inc.
> +
> +   This file is part of GDB.
> +
> +   This program is free software; you can redistribute it and/or modify
> +   it under the terms of the GNU General Public License as published by
> +   the Free Software Foundation; either version 3 of the License, or
> +   (at your option) any later version.
> +
> +   This program is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +   GNU General Public License for more details.
> +
> +   You should have received a copy of the GNU General Public License
> +   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
> +
> +#define ADD_SHARED_SYMBOL_FILES dll_symbol_command
> +void dll_symbol_command (char *, int);

At some point we should find a more elegant solution for this, but I
guess this is ok for now.

> --- a/gdb/configure.ac
> +++ b/gdb/configure.ac
> @@ -774,7 +774,7 @@ AC_FUNC_ALLOCA
>  AC_FUNC_MMAP
>  AC_FUNC_VFORK
>  AC_CHECK_FUNCS([canonicalize_file_name realpath getrusage getuid \
> -                getgid poll pread64 sbrk setpgid setpgrp setsid \
> +                getgid kill poll pread64 sbrk setpgid setpgrp setsid \
>  		sigaction sigprocmask sigsetmask socketpair syscall \
>  		ttrace wborder setlocale])

Why the hell do we need to add a check for a function defined by ISO C90?

> --- a/gdb/defs.h
> +++ b/gdb/defs.h
> @@ -132,6 +132,17 @@ typedef bfd_vma CORE_ADDR;
>  
>  #endif /* ! LONGEST */
>  
> +/* Define an integer type that has the same size as a pointer type.
> +   It is sometimes necessary to cast a pointer to an integer type
> +   (for instance to perform bitwise operations on it), and we need
> +   to use an integer type that has the same size as the pointer
> +   to prevent an error message from GCC.  */
> +#ifdef HOST_IS_LLP64
> +typedef long long ptr_int_t;
> +#else
> +typedef long ptr_int_t;
> +#endif

Instead of adding this type, can't you simply use intptr_t/uintptr_t?

> --- a/gdb/event-top.c
> +++ b/gdb/event-top.c
> @@ -50,6 +50,14 @@ static void change_line_handler (void);
>  static void change_annotation_level (void);
>  static void command_handler (char *command);
>  
> +#if defined (SIGHUP) && !defined (HAVE_KILL)
> +/* On x86_64-windows, MingW's signal.h defines SIGHUP but does not
> +   provide "kill".  However, the code that uses SIGHUP below also
> +   uses kill.  So, if kill is not available, pretend SIGHUP isn't
> +   either.  */
> +#undef SIGHUP
> +#endif

This must be a bug in MingW.  Please tell the MingW people that in
2008 they manage to ship an environment that doesn't even implement
ISO C90 correctly.  If they fix it (or have already fixed it) is it
really necessary to add this ugly workaround?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]