This is the mail archive of the gdb-patches@sources.redhat.com 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: [RFA] SSE registers for cygxin target.


At 13:39 26/11/2001 , Eli Zaretskii a écrit:

>On Mon, 26 Nov 2001, Pierre Muller wrote:
>
> > -#undef HAVE_SSE_REGS /* FIXME! win32-nat.c needs to support XMMi registers */
> > +/* Use SSE registers if winnt.h contains information about them.  */
> > +#ifdef HAVE_CONTEXT_EXTENDED_REGISTERS
> > +#define HAVE_SSE_REGS
> > +#else
>
>Is it wise to have SSE registers supported based on the compile-time 
>test?  What if the machine on which GDB runs doesn't have SSE?  Don't you 
>need a run-time test as well?
   If the machine doesn't have these registers, 
I don't know what the GetThreadContext will return
as I only tested this on a mahine that does have a Pentium iV.

   It is possible to know with API calls if 
the processor does have these registers or not, but I
don't know how to change
the macro NUM_REGS to become a variable defined 
and check at run-time, but how would that be done for 
cross-compilation of GDB with cygwin targets ?

   How is this handled for Linux ?
 From config/i386/tm-linux.h
#ifdef HAVE_PTRACE_GETFPXREGS
#define HAVE_SSE_REGS
#endif

Which in turn is also only a compile time check.

# See if <sys/ptrace.h> provides the PTRACE_GETFPXREGS request.
AC_MSG_CHECKING(for PTRACE_GETFPXREGS)
AC_CACHE_VAL(gdb_cv_have_ptrace_getfpxregs,
[AC_TRY_COMPILE([#include <sys/ptrace.h>],
                 [PTRACE_GETFPXREGS;],
                 [gdb_cv_have_ptrace_getfpxregs=yes],
                 [gdb_cv_have_ptrace_getfpxregs=no])])
AC_MSG_RESULT($gdb_cv_have_ptrace_getfpxregs)
if test $gdb_cv_have_ptrace_getfpxregs = yes; then
   AC_DEFINE(HAVE_PTRACE_GETFPXREGS)
fi

So Linux also only does a compile time check...
Of course I agree that this patch must be check to see what happens if
the running machine has no extended registers (or if the OS does not know 
about CONTEXT_EXTENDED_REGISTERS).

   Get/SetThreadContext might fail in such cases, 
if that is the case, then I know how to fix the problem:
Change CONTEXT_DEBUGGER_DR into a variable 
and remove the CONTEXT_EXTENDED_REGISTERS specific
field if the first call to GetThreadContext fails.

But if it accepts CONTEXT_EXTENDED_REGISTERS in all cases,
then we are stuck (at least for cross debuggers, no ?).

Doing a check at compile time might be a wrong way, as then we would be able to
get the SSE regs if the gdb executable was compiled on a SSE-less machine.

Any hints welcome....


Pierre Muller
Institut Charles Sadron
6,rue Boussingault
F 67083 STRASBOURG CEDEX (France)
mailto:muller@ics.u-strasbg.fr
Phone : (33)-3-88-41-40-07  Fax : (33)-3-88-41-40-99


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