Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC] Mingw Windows 64-bit gdbserver
@ 2010-04-16 15:32 Pierre Muller
  2010-04-16 15:59 ` Pedro Alves
  0 siblings, 1 reply; 16+ messages in thread
From: Pierre Muller @ 2010-04-16 15:32 UTC (permalink / raw)
  To: gdb-patches

  This patch tries to implement support for 
gdbserver on Windows 64-bit, using the mingw32
cross compiler to windows-64bit.

  I am unsure if anyone else already tried this,
but searching in gdb-patches I didn't find anything...
Don't hesitate to tell me otherwise...

  The resulting gdbserver seem usable to me,

  I do have a few questions:
  - About the new file, win64-amd64-low.c
should I remove the copyright years and only leave 2010?
should I state that it is adapted from win32-i386-low.c?

 - About gdbserver/configure regeneration:
this added several lines:
+/* Needed for new procfs interface on sparc-solaris.  */
+#define _STRUCTURED_PROC 1
  I did use autoconf version 2.64 as required...
Is this normal?

 - About the used communication library:
  -lwsock32 was not found by the mingw, but main gdb
doesn't seem to use it, should we move to ws2_32 for both win32 and win64?

  I still do have a problem when I connect
to win64 gdbserver from a multi target win32 gdb executable,
somehow, the library list does not seem to correctly 
read in the library addresses... Still investigating this.
It seems related to the fact that I do not have 
local copies of my remote DLLs.

Final question:
  Does that patch deserve a documentation or NEWS entry?


Pierre Muller
Pascal language support maintainer for GDB


2010-04-16  Pierre Muller  <muller@ics.u-strasbg.fr>

	* configure.tgt (x86_64-*-mingw*): Set BUILD_GDBSERVER to yes.

gdbserver ChangeLog entry:

2010-04-16  Pierre Muller  <muller@ics.u-strasbg.fr>

	* configure.srv (srv_amd64_regobj): Replace "x86_64-avx.o"
	by "amd64-avx.o".
	(x86_64-*-mingw*): New configuration for Windows 64bit OS.
	Set srv_mingw64 variable to `yes'.
	* configure.ac: Use `ws2_32' library for mingw64 instead of
`wsock32'.
	* configure: Regenerated.
	* win32-low.c: Use uintptr_t type to store
	addresses for both 32bit and 64bit binaries.
	(child_xfer_memory): Use uintptr_t type for local variable `addr'.
	(get_image_name): Use uintptr_t for local variable `done'.
	(psapi_get_dll_name): Use uintptr_t type for parameter
`BaseAddress'.
	(toolhelp_get_dll_name): Idem.
	(handle_load_dll): Use uintptr_t type for local variable
`load_addr'.
	(handle_unload_dll): Use unitptr_t typecast to avoid warning.
	(handle_exception): Use phex_nz to avoid warning.
	(win32_wait): Remove unused local variable `process'.
	* win64-amd64-low.c: New file adapted from win32-i386-low.c.


Index: configure.tgt
===================================================================
RCS file: /cvs/src/src/gdb/configure.tgt,v
retrieving revision 1.230
diff -u -p -r1.230 configure.tgt
--- configure.tgt	25 Feb 2010 20:30:58 -0000	1.230
+++ configure.tgt	16 Apr 2010 14:32:54 -0000
@@ -590,6 +590,7 @@ x86_64-*-mingw*)
 	gdb_target_obs="amd64-tdep.o amd64-windows-tdep.o \
                         i386-tdep.o i386-cygwin-tdep.o i387-tdep.o \
                         solib-target.o windows-tdep.o"
+	build_gdbserver=yes
         ;;
 x86_64-*-netbsd* | x86_64-*-knetbsd*-gnu)
 	# Target: NetBSD/amd64
Index: gdbserver/configure
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/configure,v
retrieving revision 1.46
diff -u -p -r1.46 configure
--- gdbserver/configure	23 Feb 2010 19:16:16 -0000	1.46
+++ gdbserver/configure	16 Apr 2010 14:32:55 -0000
@@ -4055,6 +4055,8 @@ esac
 
 if test "${srv_mingwce}" = "yes"; then
   LIBS="$LIBS -lws2"
+elif test "${srv_mingw64}" = "yes"; then
+  LIBS="$LIBS -lws2_32"
 elif test "${srv_mingw}" = "yes"; then
   LIBS="$LIBS -lwsock32"
 elif test "${srv_qnx}" = "yes"; then
@@ -4153,6 +4155,8 @@ else
 /* end confdefs.h.  */
 
 #define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris.  */
+#define _STRUCTURED_PROC 1
 #include <sys/procfs.h>
 int
 main ()
@@ -4188,6 +4192,8 @@ else
 /* end confdefs.h.  */
 
 #define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris.  */
+#define _STRUCTURED_PROC 1
 #include <sys/procfs.h>
 int
 main ()
@@ -4223,6 +4229,8 @@ else
 /* end confdefs.h.  */
 
 #define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris.  */
+#define _STRUCTURED_PROC 1
 #include <sys/procfs.h>
 int
 main ()
@@ -4258,6 +4266,8 @@ else
 /* end confdefs.h.  */
 
 #define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris.  */
+#define _STRUCTURED_PROC 1
 #include <sys/procfs.h>
 int
 main ()
Index: gdbserver/configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/configure.ac,v
retrieving revision 1.33
diff -u -p -r1.33 configure.ac
--- gdbserver/configure.ac	23 Feb 2010 19:16:16 -0000	1.33
+++ gdbserver/configure.ac	16 Apr 2010 14:32:55 -0000
@@ -117,6 +117,8 @@ esac
 
 if test "${srv_mingwce}" = "yes"; then
   LIBS="$LIBS -lws2"
+elif test "${srv_mingw64}" = "yes"; then
+  LIBS="$LIBS -lws2_32"
 elif test "${srv_mingw}" = "yes"; then
   LIBS="$LIBS -lwsock32"
 elif test "${srv_qnx}" = "yes"; then
Index: gdbserver/configure.srv
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/configure.srv,v
retrieving revision 1.53
diff -u -p -r1.53 configure.srv
--- gdbserver/configure.srv	8 Apr 2010 22:32:38 -0000	1.53
+++ gdbserver/configure.srv	16 Apr 2010 14:32:55 -0000
@@ -24,7 +24,7 @@ srv_hostio_err_objs="hostio-errno.o"
 
 srv_i386_regobj="i386.o i386-avx.o i386-mmx.o"
 srv_i386_linux_regobj="i386-linux.o i386-avx-linux.o i386-mmx-linux.o"
-srv_amd64_regobj="amd64.o x86-64-avx.o"
+srv_amd64_regobj="amd64.o amd64-avx.o"
 srv_amd64_linux_regobj="amd64-linux.o amd64-avx-linux.o"
 
 srv_i386_32bit_xmlfiles="i386/32bit-core.xml i386/32bit-sse.xml
i386/32bit-avx.xml"
@@ -231,6 +231,13 @@ case "${target}" in
 			srv_linux_regsets=yes
 			srv_linux_thread_db=yes
 			;;
+  x86_64-w64-mingw*)	srv_regobj="$srv_amd64_regobj"
+			srv_tgtobj="i386-low.o i387-fp.o win32-low.o
win64-amd64-low.o"
+			srv_xmlfiles="$srv_i386_xmlfiles
$srv_amd64_xmlfiles"
+			srv_mingw64=yes
+			srv_mingw=yes
+			;;
+
   xscale*-*-linux*)	srv_regobj=reg-arm.o
 			srv_tgtobj="linux-low.o linux-arm-low.o"
 			srv_linux_usrregs=yes
Index: gdbserver/win32-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/win32-low.c,v
retrieving revision 1.46
diff -u -p -r1.46 win32-low.c
--- gdbserver/win32-low.c	16 Apr 2010 07:49:37 -0000	1.46
+++ gdbserver/win32-low.c	16 Apr 2010 14:32:55 -0000
@@ -280,7 +280,7 @@ child_xfer_memory (CORE_ADDR memaddr, ch
 		   int write, struct target_ops *target)
 {
   SIZE_T done;
-  long addr = (long) memaddr;
+  uintptr_t addr = (uintptr_t) memaddr;
 
   if (write)
     {
@@ -941,7 +941,7 @@ get_image_name (HANDLE h, void *address,
   char *address_ptr;
   int len = 0;
   char b[2];
-  DWORD done;
+  uintptr_t done;
 
   /* Attempt to read the name of the dll that was detected.
      This is documented to work only when actively debugging
@@ -1019,7 +1019,7 @@ load_psapi (void)
 }
 
 static int
-psapi_get_dll_name (DWORD BaseAddress, char *dll_name_ret)
+psapi_get_dll_name (uintptr_t BaseAddress, char *dll_name_ret)
 {
   DWORD len;
   MODULEINFO mi;
@@ -1064,7 +1064,7 @@ psapi_get_dll_name (DWORD BaseAddress, c
 		 (int) err, strwinerror (err));
 	}
 
-      if ((DWORD) (mi.lpBaseOfDll) == BaseAddress)
+      if ((uintptr_t) (mi.lpBaseOfDll) == BaseAddress)
 	{
 	  len = (*win32_GetModuleFileNameExA) (current_process_handle,
 					       DllHandle[i],
@@ -1134,7 +1134,7 @@ load_toolhelp (void)
 }
 
 static int
-toolhelp_get_dll_name (DWORD BaseAddress, char *dll_name_ret)
+toolhelp_get_dll_name (uintptr_t BaseAddress, char *dll_name_ret)
 {
   HANDLE snapshot_module;
   MODULEENTRY32 modEntry = { sizeof (MODULEENTRY32) };
@@ -1151,7 +1151,7 @@ toolhelp_get_dll_name (DWORD BaseAddress
   /* Ignore the first module, which is the exe.  */
   if (win32_Module32First (snapshot_module, &modEntry))
     while (win32_Module32Next (snapshot_module, &modEntry))
-      if ((DWORD) modEntry.modBaseAddr == BaseAddress)
+      if ((uintptr_t) modEntry.modBaseAddr == BaseAddress)
 	{
 #ifdef UNICODE
 	  wcstombs (dll_name_ret, modEntry.szExePath, MAX_PATH + 1);
@@ -1176,21 +1176,21 @@ handle_load_dll (void)
   LOAD_DLL_DEBUG_INFO *event = &current_event.u.LoadDll;
   char dll_buf[MAX_PATH + 1];
   char *dll_name = NULL;
-  DWORD load_addr;
+  uintptr_t load_addr;
 
   dll_buf[0] = dll_buf[sizeof (dll_buf) - 1] = '\0';
 
   /* Windows does not report the image name of the dlls in the debug
      event on attaches.  We resort to iterating over the list of
      loaded dlls looking for a match by image base.  */
-  if (!psapi_get_dll_name ((DWORD) event->lpBaseOfDll, dll_buf))
+  if (!psapi_get_dll_name ((uintptr_t) event->lpBaseOfDll, dll_buf))
     {
       if (!server_waiting)
 	/* On some versions of Windows and Windows CE, we can't create
 	   toolhelp snapshots while the inferior is stopped in a
 	   LOAD_DLL_DEBUG_EVENT due to a dll load, but we can while
 	   Windows is reporting the already loaded dlls.  */
-	toolhelp_get_dll_name ((DWORD) event->lpBaseOfDll, dll_buf);
+	toolhelp_get_dll_name ((uintptr_t) event->lpBaseOfDll, dll_buf);
     }
 
   dll_name = dll_buf;
@@ -1205,7 +1205,7 @@ handle_load_dll (void)
      the offset from 0 of the first byte in an image - because
      of the file header and the section alignment. */
 
-  load_addr = (DWORD) event->lpBaseOfDll + 0x1000;
+  load_addr = (uintptr_t) event->lpBaseOfDll + 0x1000;
   win32_add_one_solib (dll_name, load_addr);
 }
 
@@ -1213,7 +1213,7 @@ static void
 handle_unload_dll (void)
 {
   CORE_ADDR load_addr =
-	  (CORE_ADDR) (DWORD) current_event.u.UnloadDll.lpBaseOfDll;
+	  (CORE_ADDR) (uintptr_t) current_event.u.UnloadDll.lpBaseOfDll;
   load_addr += 0x1000;
   unloaded_dll (NULL, load_addr);
 }
@@ -1314,10 +1314,10 @@ handle_exception (struct target_waitstat
 	  ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
 	  return;
 	}
-      OUTMSG2 (("gdbserver: unknown target exception 0x%08lx at 0x%08lx",
+      OUTMSG2 (("gdbserver: unknown target exception 0x%08lx at 0x%s",
 		current_event.u.Exception.ExceptionRecord.ExceptionCode,
-		(DWORD) current_event.u.Exception.ExceptionRecord.
-		ExceptionAddress));
+		phex_nz ((uintptr_t)
current_event.u.Exception.ExceptionRecord.
+		ExceptionAddress, sizeof(uintptr_t))));
       ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
       break;
     }
@@ -1577,7 +1577,6 @@ get_child_debug_event (struct target_wai
 static ptid_t
 win32_wait (ptid_t ptid, struct target_waitstatus *ourstatus, int options)
 {
-  struct process_info *process;
   struct regcache *regcache;
 
   while (1)
Index: gdbserver/win64-amd64-low.c
===================================================================
RCS file: gdbserver/win64-amd64-low.c
diff -N gdbserver/win64-amd64-low.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gdbserver/win64-amd64-low.c	16 Apr 2010 14:32:55 -0000
@@ -0,0 +1,343 @@
+/* Copyright (C) 2007, 2008, 2009, 2010 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 "server.h"
+#include "win32-low.h"
+#include "i386-low.h"
+
+#define FCS_REGNUM 27
+#define FOP_REGNUM 31
+
+#define FLAG_TRACE_BIT 0x100
+
+#ifndef CONTEXT_EXTENDED_REGISTERS
+#define CONTEXT_EXTENDED_REGISTERS 0
+#endif
+
+/* Defined in auto-generated file reg-amd64.c.  */
+void init_registers_amd64 (void);
+
+static struct i386_debug_reg_state debug_reg_state;
+
+static int debug_registers_changed = 0;
+static int debug_registers_used = 0;
+
+/* Update the inferior's debug register REGNUM from STATE.  */
+
+void
+i386_dr_low_set_addr (const struct i386_debug_reg_state *state, int regnum)
+{
+  if (! (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR))
+    fatal ("Invalid debug register %d", regnum);
+
+  /* debug_reg_state.dr_mirror is already set.
+     Just notify i386_set_thread_context, i386_thread_added
+     that the registers need to be updated.  */
+  debug_registers_changed = 1;
+  debug_registers_used = 1;
+}
+
+/* Update the inferior's DR7 debug control register from STATE.  */
+
+void
+i386_dr_low_set_control (const struct i386_debug_reg_state *state)
+{
+  /* debug_reg_state.dr_control_mirror is already set.
+     Just notify i386_set_thread_context, i386_thread_added
+     that the registers need to be updated.  */
+  debug_registers_changed = 1;
+  debug_registers_used = 1;
+}
+
+/* Get the value of the DR6 debug status register from the inferior
+   and record it in STATE.  */
+
+void
+i386_dr_low_get_status (struct i386_debug_reg_state *state)
+{
+  /* We don't need to do anything here, the last call to thread_rec for
+     current_event.dwThreadId id has already set it.  */
+}
+
+/* Watchpoint support.  */
+
+static int
+amd64_insert_point (char type, CORE_ADDR addr, int len)
+{
+  switch (type)
+    {
+    case '2':
+    case '3':
+    case '4':
+      return i386_low_insert_watchpoint (&debug_reg_state,
+					 type, addr, len);
+    default:
+      /* Unsupported.  */
+      return 1;
+    }
+}
+
+static int
+amd64_remove_point (char type, CORE_ADDR addr, int len)
+{
+  switch (type)
+    {
+    case '2':
+    case '3':
+    case '4':
+      return i386_low_remove_watchpoint (&debug_reg_state,
+					 type, addr, len);
+    default:
+      /* Unsupported.  */
+      return 1;
+    }
+}
+
+static int
+amd64_stopped_by_watchpoint (void)
+{
+  return i386_low_stopped_by_watchpoint (&debug_reg_state);
+}
+
+static CORE_ADDR
+amd64_stopped_data_address (void)
+{
+  CORE_ADDR addr;
+  if (i386_low_stopped_data_address (&debug_reg_state, &addr))
+    return addr;
+  return 0;
+}
+
+static void
+amd64_initial_stuff (void)
+{
+  i386_low_init_dregs (&debug_reg_state);
+  debug_registers_changed = 0;
+  debug_registers_used = 0;
+}
+
+static void
+amd64_get_thread_context (win32_thread_info *th, DEBUG_EVENT*
current_event)
+{
+  /* Requesting the CONTEXT_EXTENDED_REGISTERS register set fails if
+     the system doesn't support extended registers.  */
+  static DWORD extended_registers = CONTEXT_EXTENDED_REGISTERS;
+
+ again:
+  th->context.ContextFlags = (CONTEXT_FULL
+			      | CONTEXT_FLOATING_POINT
+			      | CONTEXT_DEBUG_REGISTERS
+			      | extended_registers);
+
+  if (!GetThreadContext (th->h, &th->context))
+    {
+      DWORD e = GetLastError ();
+
+      if (extended_registers && e == ERROR_INVALID_PARAMETER)
+	{
+	  extended_registers = 0;
+	  goto again;
+	}
+
+      error ("GetThreadContext failure %ld\n", (long) e);
+    }
+
+  debug_registers_changed = 0;
+
+  if (th->tid == current_event->dwThreadId)
+    {
+      /* Copy dr values from the current thread.  */
+      struct i386_debug_reg_state *dr = &debug_reg_state;
+      dr->dr_mirror[0] = th->context.Dr0;
+      dr->dr_mirror[1] = th->context.Dr1;
+      dr->dr_mirror[2] = th->context.Dr2;
+      dr->dr_mirror[3] = th->context.Dr3;
+      dr->dr_status_mirror = th->context.Dr6;
+      dr->dr_control_mirror = th->context.Dr7;
+    }
+}
+
+static void
+amd64_set_thread_context (win32_thread_info *th, DEBUG_EVENT*
current_event)
+{
+  if (debug_registers_changed)
+    {
+      struct i386_debug_reg_state *dr = &debug_reg_state;
+      th->context.Dr0 = dr->dr_mirror[0];
+      th->context.Dr1 = dr->dr_mirror[1];
+      th->context.Dr2 = dr->dr_mirror[2];
+      th->context.Dr3 = dr->dr_mirror[3];
+      /* th->context.Dr6 = dr->dr_status_mirror;
+	 FIXME: should we set dr6 also ?? */
+      th->context.Dr7 = dr->dr_control_mirror;
+    }
+
+  SetThreadContext (th->h, &th->context);
+}
+
+static void
+amd64_thread_added (win32_thread_info *th)
+{
+  /* Set the debug registers for the new thread if they are used.  */
+  if (debug_registers_used)
+    {
+      struct i386_debug_reg_state *dr = &debug_reg_state;
+      th->context.ContextFlags = CONTEXT_DEBUG_REGISTERS;
+      GetThreadContext (th->h, &th->context);
+
+      th->context.Dr0 = dr->dr_mirror[0];
+      th->context.Dr1 = dr->dr_mirror[1];
+      th->context.Dr2 = dr->dr_mirror[2];
+      th->context.Dr3 = dr->dr_mirror[3];
+      /* th->context.Dr6 = dr->dr_status_mirror;
+	 FIXME: should we set dr6 also ?? */
+      th->context.Dr7 = dr->dr_control_mirror;
+
+      SetThreadContext (th->h, &th->context);
+      th->context.ContextFlags = 0;
+    }
+}
+
+static void
+amd64_single_step (win32_thread_info *th)
+{
+  th->context.EFlags |= FLAG_TRACE_BIT;
+}
+
+/* An array of offset mappings into a Win64 Context structure.
+   This is a one-to-one mapping which is indexed by gdb's register
+   numbers.  It retrieves an offset into the context structure where
+   the register is located.
+   An offset value of -1 indicates that Win64 does not provide this
+   register in it's CONTEXT structure.  In this case regptr will return
+   a pointer into a dummy register.  */
+#define context_offset(x) (offsetof (CONTEXT, x))
+static const int mappings[] =
+{
+  context_offset (Rax),
+  context_offset (Rbx),
+  context_offset (Rcx),
+  context_offset (Rdx),
+  context_offset (Rsi),
+  context_offset (Rdi),
+  context_offset (Rbp),
+  context_offset (Rsp),
+  context_offset (R8),
+  context_offset (R9),
+  context_offset (R10),
+  context_offset (R11),
+  context_offset (R12),
+  context_offset (R13),
+  context_offset (R14),
+  context_offset (R15),
+  context_offset (Rip),
+  context_offset (EFlags),
+  context_offset (SegCs),
+  context_offset (SegSs),
+  context_offset (SegDs),
+  context_offset (SegEs),
+  context_offset (SegFs),
+  context_offset (SegGs),
+  context_offset (FloatSave.FloatRegisters[0]),
+  context_offset (FloatSave.FloatRegisters[1]),
+  context_offset (FloatSave.FloatRegisters[2]),
+  context_offset (FloatSave.FloatRegisters[3]),
+  context_offset (FloatSave.FloatRegisters[4]),
+  context_offset (FloatSave.FloatRegisters[5]),
+  context_offset (FloatSave.FloatRegisters[6]),
+  context_offset (FloatSave.FloatRegisters[7]),
+  context_offset (FloatSave.ControlWord),
+  context_offset (FloatSave.StatusWord),
+  context_offset (FloatSave.TagWord),
+  context_offset (FloatSave.ErrorSelector),
+  context_offset (FloatSave.ErrorOffset),
+  context_offset (FloatSave.DataSelector),
+  context_offset (FloatSave.DataOffset),
+  context_offset (FloatSave.ErrorSelector)
+  /* XMM0-7 */ ,
+  context_offset (Xmm0),
+  context_offset (Xmm1),
+  context_offset (Xmm2),
+  context_offset (Xmm3),
+  context_offset (Xmm4),
+  context_offset (Xmm5),
+  context_offset (Xmm6),
+  context_offset (Xmm7),
+  context_offset (Xmm8),
+  context_offset (Xmm9),
+  context_offset (Xmm10),
+  context_offset (Xmm11),
+  context_offset (Xmm12),
+  context_offset (Xmm13),
+  context_offset (Xmm14),
+  context_offset (Xmm15),
+  /* MXCSR */
+  context_offset (FloatSave.MxCsr)
+};
+#undef context_offset
+
+/* Fetch register from gdbserver regcache data.  */
+static void
+amd64_fetch_inferior_register (struct regcache *regcache,
+			      win32_thread_info *th, int r)
+{
+  char *context_offset = (char *) &th->context + mappings[r];
+
+  long l;
+  if (r == FCS_REGNUM)
+    {
+      l = *((long *) context_offset) & 0xffff;
+      supply_register (regcache, r, (char *) &l);
+    }
+  else if (r == FOP_REGNUM)
+    {
+      l = (*((long *) context_offset) >> 16) & ((1 << 11) - 1);
+      supply_register (regcache, r, (char *) &l);
+    }
+  else
+    supply_register (regcache, r, context_offset);
+}
+
+/* Store a new register value into the thread context of TH.  */
+static void
+amd64_store_inferior_register (struct regcache *regcache,
+			      win32_thread_info *th, int r)
+{
+  char *context_offset = (char *) &th->context + mappings[r];
+  collect_register (regcache, r, context_offset);
+}
+
+static const unsigned char amd64_win64_breakpoint = 0xcc;
+#define amd64_win64_breakpoint_len 1
+
+struct win32_target_ops the_low_target = {
+  init_registers_amd64,
+  sizeof (mappings) / sizeof (mappings[0]),
+  amd64_initial_stuff,
+  amd64_get_thread_context,
+  amd64_set_thread_context,
+  amd64_thread_added,
+  amd64_fetch_inferior_register,
+  amd64_store_inferior_register,
+  amd64_single_step,
+  &amd64_win64_breakpoint,
+  amd64_win64_breakpoint_len,
+  amd64_insert_point,
+  amd64_remove_point,
+  amd64_stopped_by_watchpoint,
+  amd64_stopped_data_address
+};


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [RFC] Mingw Windows 64-bit gdbserver
  2010-04-16 15:32 [RFC] Mingw Windows 64-bit gdbserver Pierre Muller
@ 2010-04-16 15:59 ` Pedro Alves
  2010-04-16 16:20   ` Pierre Muller
  2010-04-17  5:40   ` [RFC] Mingw Windows 64-bit gdbserver Pierre Muller
  0 siblings, 2 replies; 16+ messages in thread
From: Pedro Alves @ 2010-04-16 15:59 UTC (permalink / raw)
  To: gdb-patches; +Cc: Pierre Muller

On Friday 16 April 2010 16:31:51, Pierre Muller wrote:
>   This patch tries to implement support for 
> gdbserver on Windows 64-bit, using the mingw32
> cross compiler to windows-64bit.
> 
>   I am unsure if anyone else already tried this,
> but searching in gdb-patches I didn't find anything...
> Don't hesitate to tell me otherwise...
> 
>   The resulting gdbserver seem usable to me,
> 
>   I do have a few questions:
>   - About the new file, win64-amd64-low.c
> should I remove the copyright years and only leave 2010?
> should I state that it is adapted from win32-i386-low.c?

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.  Also, is there any debug API limitation that would
make it impossible for a 64-bit gdbserver to debug a 32-bit
inferior (that is, multi-arch the Windows gdbserver)?
That being possible would be another reason to just merge
the files up from the start.

> 
>  - About gdbserver/configure regeneration:
> this added several lines:
> +/* Needed for new procfs interface on sparc-solaris.  */
> +#define _STRUCTURED_PROC 1
>   I did use autoconf version 2.64 as required...
> Is this normal?

Yes, it just means that someone change src/bfd/bfd.m4,
and this configure had never been regenerated
(gdbserver/acinclude.m4 pulls in bfd.m4).
You could just regenerate the file and apply that bit
alone, independently of your real gdbserver changes, so
your changes are clean.  Want to do that?

> 
>  - About the used communication library:
>   -lwsock32 was not found by the mingw, but main gdb
> doesn't seem to use it, should we move to ws2_32 for both win32 and win64?

Don't we need to make gdbserver include windows2.h instead of winsock.h too?

> 
>   I still do have a problem when I connect
> to win64 gdbserver from a multi target win32 gdb executable,
> somehow, the library list does not seem to correctly 
> read in the library addresses... Still investigating this.
> It seems related to the fact that I do not have 
> local copies of my remote DLLs.
> 

> Final question:
>   Does that patch deserve a documentation or NEWS entry?

At least the latter, definitely.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [RFC] Mingw Windows 64-bit gdbserver
  2010-04-16 15:59 ` Pedro Alves
@ 2010-04-16 16:20   ` Pierre Muller
  2010-04-16 16:27     ` Pedro Alves
  2010-04-17  5:40   ` [RFC] Mingw Windows 64-bit gdbserver Pierre Muller
  1 sibling, 1 reply; 16+ messages in thread
From: Pierre Muller @ 2010-04-16 16:20 UTC (permalink / raw)
  To: 'Pedro Alves', gdb-patches

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : Friday, April 16, 2010 6:00 PM
> À : gdb-patches@sourceware.org
> Cc : Pierre Muller
> Objet : Re: [RFC] Mingw Windows 64-bit gdbserver
> 
> On Friday 16 April 2010 16:31:51, Pierre Muller wrote:
> >   This patch tries to implement support for
> > gdbserver on Windows 64-bit, using the mingw32
> > cross compiler to windows-64bit.
> >
> >   I am unsure if anyone else already tried this,
> > but searching in gdb-patches I didn't find anything...
> > Don't hesitate to tell me otherwise...
> >
> >   The resulting gdbserver seem usable to me,
> >
> >   I do have a few questions:
> >   - About the new file, win64-amd64-low.c
> > should I remove the copyright years and only leave 2010?
> > should I state that it is adapted from win32-i386-low.c?
> 
> 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.
 Yes, but ...
>  Also, is there any debug API limitation that would
> make it impossible for a 64-bit gdbserver to debug a 32-bit
> inferior (that is, multi-arch the Windows gdbserver)?
 It not impossible, but it doesn't work 
without using some new API functions:
Wow64GetThreadContext, Wow64GetThreadSelectorEntry,
and Wow64SetThreadContext

See http://msdn.microsoft.com/en-us/library/ms679303%28VS.85%29.aspx

This would also be required to be able to debug win32 
application within a windows 64-bit GDB executable.

Implementing this is probably a larger patch than this one ...

> That being possible would be another reason to just merge
> the files up from the start.

 So that argument falls!
> >
> >  - About gdbserver/configure regeneration:
> > this added several lines:
> > +/* Needed for new procfs interface on sparc-solaris.  */
> > +#define _STRUCTURED_PROC 1
> >   I did use autoconf version 2.64 as required...
> > Is this normal?
> 
> Yes, it just means that someone change src/bfd/bfd.m4,
> and this configure had never been regenerated
> (gdbserver/acinclude.m4 pulls in bfd.m4).
> You could just regenerate the file and apply that bit
> alone, independently of your real gdbserver changes, so
> your changes are clean.  Want to do that?
 Done. 
> >
> >  - About the used communication library:
> >   -lwsock32 was not found by the mingw, but main gdb
> > doesn't seem to use it, should we move to ws2_32 for both win32 and
> win64?
> 
> Don't we need to make gdbserver include windows2.h instead of winsock.h
> too?

 No, I only found #include <windows.h>
> >
> >   I still do have a problem when I connect
> > to win64 gdbserver from a multi target win32 gdb executable,
> > somehow, the library list does not seem to correctly
> > read in the library addresses... Still investigating this.
> > It seems related to the fact that I do not have
> > local copies of my remote DLLs.
> >
> 
> > Final question:
> >   Does that patch deserve a documentation or NEWS entry?
> 
> At least the latter, definitely.
  Should be easy to add.

Pierre


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [RFC] Mingw Windows 64-bit gdbserver
  2010-04-16 16:20   ` Pierre Muller
@ 2010-04-16 16:27     ` Pedro Alves
  2010-04-16 16:38       ` Pierre Muller
  0 siblings, 1 reply; 16+ messages in thread
From: Pedro Alves @ 2010-04-16 16:27 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches

On Friday 16 April 2010 17:20:18, 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.
>  Yes, but ...
> >  Also, is there any debug API limitation that would
> > make it impossible for a 64-bit gdbserver to debug a 32-bit
> > inferior (that is, multi-arch the Windows gdbserver)?
>  It not impossible, but it doesn't work 
> without using some new API functions:
> Wow64GetThreadContext, Wow64GetThreadSelectorEntry,
> and Wow64SetThreadContext
> 
> See http://msdn.microsoft.com/en-us/library/ms679303%28VS.85%29.aspx
> 
> This would also be required to be able to debug win32 
> application within a windows 64-bit GDB executable.
> 
> Implementing this is probably a larger patch than this one ...

I didn't mean to suggest you work on that.  Merely to
consider if once we implement that, we'll end up merging
the files anyway...

> > That being possible would be another reason to just merge
> > the files up from the start.
> 
>  So that argument falls!

Of course it doesn't.  But okay, let's keep them appart
anyway.  Easy to merge any other time.

> > >  - About the used communication library:
> > >   -lwsock32 was not found by the mingw, but main gdb
> > > doesn't seem to use it, should we move to ws2_32 for both win32 and
> > win64?
> > 
> > Don't we need to make gdbserver include windows2.h instead of winsock.h
> > too?
> 
>  No, I only found #include <windows.h>

Typo: I meant winsock2.h instead of winsock.h.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [RFC] Mingw Windows 64-bit gdbserver
  2010-04-16 16:27     ` Pedro Alves
@ 2010-04-16 16:38       ` Pierre Muller
  2010-04-16 17:15         ` Pedro Alves
  0 siblings, 1 reply; 16+ messages in thread
From: Pierre Muller @ 2010-04-16 16:38 UTC (permalink / raw)
  To: 'Pedro Alves'; +Cc: gdb-patches

  GDb sources is still a mix:

> Typo: I meant winsock2.h instead of winsock.h.

$ grep "include.*<winso" *.h  gdbserver/*.h *.c gdbserver/*.c
gdb_select.h:#include <winsock2.h>
serial.h:#include <winsock2.h>
m32r-rom.c:#include <winsock.h>
remote-m32r-sdi.c:#include <winsock.h>
ser-base.c:#include <winsock2.h>
ser-tcp.c:#include <winsock2.h>
gdbserver/gdbreplay.c:#include <winsock.h>
gdbserver/remote-utils.c:#include <winsock.h>

should all be moved to winsock2.h?
and -lws2_32 as library?

By the way, do the m32r sources still link correctly currently?

Pierre


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [RFC] Mingw Windows 64-bit gdbserver
  2010-04-16 16:38       ` Pierre Muller
@ 2010-04-16 17:15         ` Pedro Alves
  2010-04-17  5:39           ` [RFA] Use winsock2 for mingw gdbserver Pierre Muller
  0 siblings, 1 reply; 16+ messages in thread
From: Pedro Alves @ 2010-04-16 17:15 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches

On Friday 16 April 2010 17:38:28, Pierre Muller wrote:
>   GDb sources is still a mix:
> 
> > Typo: I meant winsock2.h instead of winsock.h.
> 
> $ grep "include.*<winso" *.h  gdbserver/*.h *.c gdbserver/*.c
> gdb_select.h:#include <winsock2.h>
> serial.h:#include <winsock2.h>
> m32r-rom.c:#include <winsock.h>
> remote-m32r-sdi.c:#include <winsock.h>
> ser-base.c:#include <winsock2.h>
> ser-tcp.c:#include <winsock2.h>
> gdbserver/gdbreplay.c:#include <winsock.h>
> gdbserver/remote-utils.c:#include <winsock.h>
> 
> should all be moved to winsock2.h?

Probably not a real problem as we only activate
Winsock 1:

gdb/
>grep WSAStart *.c -rn
m32r-rom.c:451:      if (WSAStartup (MAKEWORD (1, 1), &wd))
ser-mingw.c:1255:  if (WSAStartup (MAKEWORD (1, 0), &wsa_data) != 0)

gdb/gdbserver/
>grep WSAStart *.c -rn
gdbreplay.c:207:          WSAStartup (MAKEWORD (1, 0), &wsad);
remote-utils.c:288:       WSAStartup (MAKEWORD (1, 0), &wsad);

Presumably winsock2.h is a superset of winsock.h and so we're
likely fine.  Wouldn't hurt to be consistent, moreso since we
include winsock2.h in some headers.

> and -lws2_32 as library?

You mean in gdbserver?  Shouldn't hurt, yeah.

> By the way, do the m32r sources still link correctly currently?

No idea.  There were recent changes to some of those
files though.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [RFA] Use winsock2 for mingw gdbserver
  2010-04-16 17:15         ` Pedro Alves
@ 2010-04-17  5:39           ` Pierre Muller
  2010-04-17  8:28             ` Pedro Alves
  0 siblings, 1 reply; 16+ messages in thread
From: Pierre Muller @ 2010-04-17  5:39 UTC (permalink / raw)
  To: 'Pedro Alves'; +Cc: gdb-patches

  I implement this as a separate patch:
I just tested compilation with msys/mingw system.

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : Friday, April 16, 2010 7:16 PM
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org
> Objet : Re: [RFC] Mingw Windows 64-bit gdbserver
> 
> On Friday 16 April 2010 17:38:28, Pierre Muller wrote:
> >   GDb sources is still a mix:
> >
> > > Typo: I meant winsock2.h instead of winsock.h.
> >
> > $ grep "include.*<winso" *.h  gdbserver/*.h *.c gdbserver/*.c
> > gdb_select.h:#include <winsock2.h>
> > serial.h:#include <winsock2.h>
> > m32r-rom.c:#include <winsock.h>
> > remote-m32r-sdi.c:#include <winsock.h>
> > ser-base.c:#include <winsock2.h>
> > ser-tcp.c:#include <winsock2.h>
> > gdbserver/gdbreplay.c:#include <winsock.h>
> > gdbserver/remote-utils.c:#include <winsock.h>
> >
> > should all be moved to winsock2.h?
> 
> Probably not a real problem as we only activate
> Winsock 1:
> 
> gdb/
> >grep WSAStart *.c -rn
> m32r-rom.c:451:      if (WSAStartup (MAKEWORD (1, 1), &wd))
> ser-mingw.c:1255:  if (WSAStartup (MAKEWORD (1, 0), &wsa_data) != 0)
> 
> gdb/gdbserver/
> >grep WSAStart *.c -rn
> gdbreplay.c:207:          WSAStartup (MAKEWORD (1, 0), &wsad);
> remote-utils.c:288:       WSAStartup (MAKEWORD (1, 0), &wsad);
> 
> Presumably winsock2.h is a superset of winsock.h and so we're
> likely fine.  Wouldn't hurt to be consistent, moreso since we
> include winsock2.h in some headers.
> 
> > and -lws2_32 as library?
> 
> You mean in gdbserver?  Shouldn't hurt, yeah.

 Here you are:
is this OK?
  Once again, it’s the formatting of the
ChangeLog that seems the most uncertain to me...

Pierre

gdbserver ChangeLog entry:

2010-04-17  Pierre Muller  <muller@ics.u-strasbg.fr>

	* configure.ac: Use `ws2_32' library for srv_mingw.
	* configure: Regenerate.
	* gdbreplay.c: Use winsock2 header instead of winsock for mingw.
	* remote-utils.c: Likewise.

Index: configure
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/configure,v
retrieving revision 1.47
diff -u -p -r1.47 configure
--- configure	16 Apr 2010 16:22:15 -0000	1.47
+++ configure	17 Apr 2010 05:25:59 -0000
@@ -4056,7 +4056,7 @@ esac
 if test "${srv_mingwce}" = "yes"; then
   LIBS="$LIBS -lws2"
 elif test "${srv_mingw}" = "yes"; then
-  LIBS="$LIBS -lwsock32"
+  LIBS="$LIBS -lws2_32"
 elif test "${srv_qnx}" = "yes"; then
   LIBS="$LIBS -lsocket"
 fi
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/configure.ac,v
retrieving revision 1.33
diff -u -p -r1.33 configure.ac
--- configure.ac	23 Feb 2010 19:16:16 -0000	1.33
+++ configure.ac	17 Apr 2010 05:25:59 -0000
@@ -118,7 +118,7 @@ esac
 if test "${srv_mingwce}" = "yes"; then
   LIBS="$LIBS -lws2"
 elif test "${srv_mingw}" = "yes"; then
-  LIBS="$LIBS -lwsock32"
+  LIBS="$LIBS -lws2_32"
 elif test "${srv_qnx}" = "yes"; then
   LIBS="$LIBS -lsocket"
 fi
Index: gdbreplay.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/gdbreplay.c,v
retrieving revision 1.24
diff -u -p -r1.24 gdbreplay.c
--- gdbreplay.c	1 Jan 2010 07:31:49 -0000	1.24
+++ gdbreplay.c	17 Apr 2010 05:25:59 -0000
@@ -59,7 +59,7 @@
 #endif
 
 #if USE_WIN32API
-#include <winsock.h>
+#include <winsock2.h>
 #endif
 
 #ifndef HAVE_SOCKLEN_T
Index: remote-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/remote-utils.c,v
retrieving revision 1.72
diff -u -p -r1.72 remote-utils.c
--- remote-utils.c	11 Apr 2010 16:33:56 -0000	1.72
+++ remote-utils.c	17 Apr 2010 05:25:59 -0000
@@ -63,7 +63,7 @@
 #endif
 
 #if USE_WIN32API
-#include <winsock.h>
+#include <winsock2.h>
 #endif
 
 #if __QNX__


^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [RFC] Mingw Windows 64-bit gdbserver
  2010-04-16 15:59 ` Pedro Alves
  2010-04-16 16:20   ` Pierre Muller
@ 2010-04-17  5:40   ` Pierre Muller
  2010-04-17 10:58     ` Pedro Alves
  1 sibling, 1 reply; 16+ messages in thread
From: Pierre Muller @ 2010-04-17  5:40 UTC (permalink / raw)
  To: 'Pedro Alves', gdb-patches

 > -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : Friday, April 16, 2010 6:00 PM
> À : gdb-patches@sourceware.org
> Cc : Pierre Muller
> Objet : Re: [RFC] Mingw Windows 64-bit gdbserver
> 
> On Friday 16 April 2010 16:31:51, Pierre Muller wrote:
> >   This patch tries to implement support for
> > gdbserver on Windows 64-bit, using the mingw32
> > cross compiler to windows-64bit.
> >
> >   I am unsure if anyone else already tried this,
> > but searching in gdb-patches I didn't find anything...
> > Don't hesitate to tell me otherwise...
> >
> >   The resulting gdbserver seem usable to me,
> >
> >   I do have a few questions:
> >   - About the new file, win64-amd64-low.c
> > should I remove the copyright years and only leave 2010?
> > should I state that it is adapted from win32-i386-low.c?
> 
> 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

  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.

  The problem with this approach is that I 
don't know if it is OK to put
a static array (the mappings) into a header?
  If this is not regarded as a good C practice
we could use win32-i386-low.c and win64-amd64-low.c
to directly include the same things as the headers
I described above and include the C files instead.
  I was thinking that including C files directly
was  not good practice, but it is already used for the 
files generated from the XML feature files, so 
this might be a second option.

  Please just let me know which option seems
more favorable to you and I will try to 
implement it.

Pierre



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [RFA] Use winsock2 for mingw gdbserver
  2010-04-17  5:39           ` [RFA] Use winsock2 for mingw gdbserver Pierre Muller
@ 2010-04-17  8:28             ` Pedro Alves
  2010-04-17 20:44               ` Pierre Muller
  0 siblings, 1 reply; 16+ messages in thread
From: Pedro Alves @ 2010-04-17  8:28 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches

On Saturday 17 April 2010 06:39:45, Pierre Muller wrote:

> 
>  Here you are:
> is this OK?
>   Once again, it’s the formatting of the
> ChangeLog that seems the most uncertain to me...

It's fine, although "Include winsock2.h instead of winsock.h" would be
more straight to the point... (doesn't need to answer the question:
"and what is the winsock2 header in the first place? ws2.h?  other?")

When in doubt, start by looking at previous entries.  There are several
`* file.c (foo): Include bar.h.', but none `* file.c (foo): Include bar header.'

> 2010-04-17  Pierre Muller  <muller@ics.u-strasbg.fr>
> 
> 	* configure.ac: Use `ws2_32' library for srv_mingw.
> 	* configure: Regenerate.
> 	* gdbreplay.c: Use winsock2 header instead of winsock for mingw.
> 	* remote-utils.c: Likewise.

This is okay.

> 
> Index: configure
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbserver/configure,v
> retrieving revision 1.47
> diff -u -p -r1.47 configure
> --- configure	16 Apr 2010 16:22:15 -0000	1.47
> +++ configure	17 Apr 2010 05:25:59 -0000
> @@ -4056,7 +4056,7 @@ esac
>  if test "${srv_mingwce}" = "yes"; then
>    LIBS="$LIBS -lws2"
>  elif test "${srv_mingw}" = "yes"; then
> -  LIBS="$LIBS -lwsock32"
> +  LIBS="$LIBS -lws2_32"
>  elif test "${srv_qnx}" = "yes"; then
>    LIBS="$LIBS -lsocket"
>  fi
> Index: configure.ac
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbserver/configure.ac,v
> retrieving revision 1.33
> diff -u -p -r1.33 configure.ac
> --- configure.ac	23 Feb 2010 19:16:16 -0000	1.33
> +++ configure.ac	17 Apr 2010 05:25:59 -0000
> @@ -118,7 +118,7 @@ esac
>  if test "${srv_mingwce}" = "yes"; then
>    LIBS="$LIBS -lws2"
>  elif test "${srv_mingw}" = "yes"; then
> -  LIBS="$LIBS -lwsock32"
> +  LIBS="$LIBS -lws2_32"
>  elif test "${srv_qnx}" = "yes"; then
>    LIBS="$LIBS -lsocket"
>  fi
> Index: gdbreplay.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbserver/gdbreplay.c,v
> retrieving revision 1.24
> diff -u -p -r1.24 gdbreplay.c
> --- gdbreplay.c	1 Jan 2010 07:31:49 -0000	1.24
> +++ gdbreplay.c	17 Apr 2010 05:25:59 -0000
> @@ -59,7 +59,7 @@
>  #endif
>  
>  #if USE_WIN32API
> -#include <winsock.h>
> +#include <winsock2.h>
>  #endif
>  
>  #ifndef HAVE_SOCKLEN_T
> Index: remote-utils.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbserver/remote-utils.c,v
> retrieving revision 1.72
> diff -u -p -r1.72 remote-utils.c
> --- remote-utils.c	11 Apr 2010 16:33:56 -0000	1.72
> +++ remote-utils.c	17 Apr 2010 05:25:59 -0000
> @@ -63,7 +63,7 @@
>  #endif
>  
>  #if USE_WIN32API
> -#include <winsock.h>
> +#include <winsock2.h>
>  #endif
>  
>  #if __QNX__
> 
> 


-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [RFC] Mingw Windows 64-bit gdbserver
  2010-04-17  5:40   ` [RFC] Mingw Windows 64-bit gdbserver Pierre Muller
@ 2010-04-17 10:58     ` Pedro Alves
  2010-04-17 23:18       ` [RFC-v2] " Pierre Muller
  0 siblings, 1 reply; 16+ messages in thread
From: Pedro Alves @ 2010-04-17 10:58 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [RFA] Use winsock2 for mingw gdbserver
  2010-04-17  8:28             ` Pedro Alves
@ 2010-04-17 20:44               ` Pierre Muller
  0 siblings, 0 replies; 16+ messages in thread
From: Pierre Muller @ 2010-04-17 20:44 UTC (permalink / raw)
  To: 'Pedro Alves'; +Cc: gdb-patches



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : Saturday, April 17, 2010 10:28 AM
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org
> Objet : Re: [RFA] Use winsock2 for mingw gdbserver
> 
> On Saturday 17 April 2010 06:39:45, Pierre Muller wrote:
> 
> >
> >  Here you are:
> > is this OK?
> >   Once again, it’s the formatting of the
> > ChangeLog that seems the most uncertain to me...
> 
> It's fine, although "Include winsock2.h instead of winsock.h" would be
> more straight to the point... (doesn't need to answer the question:
> "and what is the winsock2 header in the first place? ws2.h?  other?")
> 
> When in doubt, start by looking at previous entries.  There are several
> `* file.c (foo): Include bar.h.', but none `* file.c (foo): Include bar
> header.'
> 
> > 2010-04-17  Pierre Muller  <muller@ics.u-strasbg.fr>
> >
> > 	* configure.ac: Use `ws2_32' library for srv_mingw.
> > 	* configure: Regenerate.
> > 	* gdbreplay.c: Use winsock2 header instead of winsock for mingw.
> > 	* remote-utils.c: Likewise.
> 
> This is okay.

  Thanks, committed now, with a changed ChangeLog as you suggested above.

Pierre


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [RFC-v2] Mingw Windows 64-bit gdbserver
  2010-04-17 10:58     ` Pedro Alves
@ 2010-04-17 23:18       ` Pierre Muller
  2010-04-17 23:46         ` Pedro Alves
  0 siblings, 1 reply; 16+ messages in thread
From: Pierre Muller @ 2010-04-17 23:18 UTC (permalink / raw)
  To: 'Pedro Alves'; +Cc: gdb-patches



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : Saturday, April 17, 2010 12:58 PM
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org
> Objet : Re: [RFC] Mingw Windows 64-bit gdbserver
> 
> 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.

  Here is a new version of the patch:
I tried to minimize code duplication, but I
still needed one macro to decide which file
from win32-i386-low.c or win64-amd64-low.c 
should be read.
  The macro is named COMPILE_WIN64 and set
by configuration in config.h header.
  I also change the regular expression used for
target matching to 'x86_64-*-mingw*' as is done in gdb directory.

  mappings is now a pointer, that is set to 
windows_i386_mappings or windows_amd64_mappings.
This should minimize problems if we later want to
support debugging windows 32-bit programs with
a 64-bit gdbserver.

  The ChangeLog is a bit messy because I renamed a file
and reused the old name to create a new file...
but I didn't find another name that would fit better...
Unless I use windows- as a prefix everywhere...

 
Pierre


2010-04-18  Pierre Muller  <muller@ics.u-strasbg.fr>

	* configure.tgt (x86_64-*-mingw*): Mark building of
	gdbserver for this target.
	
gdbserver ChangeLog entry:
2010-04-18  Pierre Muller  <muller@ics.u-strasbg.fr>

	* configure.ac (COMPILE_WIN64): New macro for config.h
	defined if srv_mingw64 is set to `yes'.
	* config.in: Regenerate.
	* configure: Regenerate.
	* configure.srv: Adapt to win32-i386-low.c to
	windows-x86-low.c rename.
	(x86_64-*-mingw*): New server target.
	* win32-i386-low.c: Rename to ...
	* windows-x86-low.c: New file name, reads in
	`win32-i386-low.c' or `win64-amdd64-low.c'.
	(mappings): New static variable.
	(the_low_target): Change arch_setup field to init_windows_x86.
	* win32-i386-low.c: New file.
	(init_registers_i386): Declare external.
	(windows_i386_mappings): Array moved from old win32-i386-low.c.
	(init_windows_x86): New function.
	* win64-amd64-low.c: New file.
	(init_registers_amd64): Declare external.
	(windows_amd64_mappings): New array.
	(init_windows_x86): New function.
	* win32-low.c: Adapt to support also 64-bit architecture.
	(child_xfer_memory): Use uintptr_t type for local variable `addr'.
	(get_image_name): Use SIZE_T type for local variable `done'.
	(psapi_get_dll_name): Use uintptr_t type for parameter
`BaseAddress'.
	(toolhelp_get_dll_name): Idem.
	(handle_load_dll): Use uintptr_t type for local variable
`load_addr'.
	(handle_unload_dll): Use unitptr_t typecast to avoid warning.
	(handle_exception): Use phex_nz to avoid warning.
	(win32_wait): Remove unused local variable `process'.


Index: configure.tgt
===================================================================
RCS file: /cvs/src/src/gdb/configure.tgt,v
retrieving revision 1.230
diff -u -p -r1.230 configure.tgt
--- configure.tgt	25 Feb 2010 20:30:58 -0000	1.230
+++ configure.tgt	17 Apr 2010 22:08:33 -0000
@@ -590,6 +590,7 @@ x86_64-*-mingw*)
 	gdb_target_obs="amd64-tdep.o amd64-windows-tdep.o \
                         i386-tdep.o i386-cygwin-tdep.o i387-tdep.o \
                         solib-target.o windows-tdep.o"
+	build_gdbserver=yes
         ;;
 x86_64-*-netbsd* | x86_64-*-knetbsd*-gnu)
 	# Target: NetBSD/amd64
Index: gdbserver/config.in
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/config.in,v
retrieving revision 1.26
diff -u -p -r1.26 config.in
--- gdbserver/config.in	21 Dec 2009 20:52:53 -0000	1.26
+++ gdbserver/config.in	17 Apr 2010 22:08:33 -0000
@@ -1,5 +1,8 @@
 /* config.in.  Generated from configure.ac by autoheader.  */
 
+/* Define if we compile a Windows-64 bit program. */
+#undef COMPILE_WIN64
+
 /* Define to 1 if you have the <arpa/inet.h> header file. */
 #undef HAVE_ARPA_INET_H
 
@@ -33,6 +36,9 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `dl' library (-ldl). */
+#undef HAVE_LIBDL
+
 /* Define to 1 if you have the <linux/elf.h> header file. */
 #undef HAVE_LINUX_ELF_H
 
Index: gdbserver/configure
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/configure,v
retrieving revision 1.48
diff -u -p -r1.48 configure
--- gdbserver/configure	17 Apr 2010 20:43:13 -0000	1.48
+++ gdbserver/configure	17 Apr 2010 22:08:35 -0000
@@ -4067,6 +4067,12 @@ $as_echo "#define USE_WIN32API 1" >>conf
 
 fi
 
+if test "${srv_mingw64}" = "yes"; then
+
+$as_echo "#define COMPILE_WIN64 1" >>confdefs.h
+
+fi
+
 if test "${srv_linux_usrregs}" = "yes"; then
 
 $as_echo "#define HAVE_LINUX_USRREGS 1" >>confdefs.h
Index: gdbserver/configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/configure.ac,v
retrieving revision 1.34
diff -u -p -r1.34 configure.ac
--- gdbserver/configure.ac	17 Apr 2010 20:43:13 -0000	1.34
+++ gdbserver/configure.ac	17 Apr 2010 22:08:35 -0000
@@ -131,6 +131,11 @@ if test "${srv_mingw}" = "yes"; then
 	     for Cygwin.])
 fi
 
+if test "${srv_mingw64}" = "yes"; then
+  AC_DEFINE(COMPILE_WIN64, 1,
+	    [Define if we compile a Windows-64 bit program.])
+fi
+
 if test "${srv_linux_usrregs}" = "yes"; then
   AC_DEFINE(HAVE_LINUX_USRREGS, 1,
 	    [Define if the target supports PTRACE_PEEKUSR for register ]
Index: gdbserver/configure.srv
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/configure.srv,v
retrieving revision 1.53
diff -u -p -r1.53 configure.srv
--- gdbserver/configure.srv	8 Apr 2010 22:32:38 -0000	1.53
+++ gdbserver/configure.srv	17 Apr 2010 22:08:35 -0000
@@ -24,7 +24,7 @@ srv_hostio_err_objs="hostio-errno.o"
 
 srv_i386_regobj="i386.o i386-avx.o i386-mmx.o"
 srv_i386_linux_regobj="i386-linux.o i386-avx-linux.o i386-mmx-linux.o"
-srv_amd64_regobj="amd64.o x86-64-avx.o"
+srv_amd64_regobj="amd64.o amd64-avx.o"
 srv_amd64_linux_regobj="amd64-linux.o amd64-avx-linux.o"
 
 srv_i386_32bit_xmlfiles="i386/32bit-core.xml i386/32bit-sse.xml
i386/32bit-avx.xml"
@@ -73,7 +73,7 @@ case "${target}" in
 			srv_linux_thread_db=yes
 			;;
   i[34567]86-*-cygwin*)	srv_regobj="$srv_i386_regobj"
-			srv_tgtobj="i386-low.o win32-low.o win32-i386-low.o"
+			srv_tgtobj="i386-low.o win32-low.o
windows-x86-low.o"
 			srv_xmlfiles="$srv_i386_xmlfiles"
 			;;
   i[34567]86-*-linux*)	srv_regobj="$srv_i386_linux_regobj"
@@ -89,7 +89,7 @@ case "${target}" in
 			;;
   i[34567]86-*-mingw32ce*)
 			srv_regobj="$srv_i386_regobj"
-			srv_tgtobj="i386-low.o win32-low.o win32-i386-low.o"
+			srv_tgtobj="i386-low.o win32-low.o
windows-x86-low.o"
 			srv_tgtobj="${srv_tgtobj} wincecompat.o"
 			srv_xmlfiles="$srv_i386_xmlfiles"
 			# hostio_last_error implementation is in win32-low.c
@@ -98,7 +98,7 @@ case "${target}" in
 			srv_mingwce=yes
 			;;
   i[34567]86-*-mingw*)	srv_regobj="$srv_i386_regobj"
-			srv_tgtobj="i386-low.o win32-low.o win32-i386-low.o"
+			srv_tgtobj="i386-low.o win32-low.o
windows-x86-low.o"
 			srv_xmlfiles="$srv_i386_xmlfiles"
 			srv_mingw=yes
 			;;
@@ -231,6 +231,13 @@ case "${target}" in
 			srv_linux_regsets=yes
 			srv_linux_thread_db=yes
 			;;
+  x86_64-*-mingw*)	srv_regobj="$srv_amd64_regobj"
+			srv_tgtobj="i386-low.o win32-low.o
windows-x86-low.o"
+			srv_xmlfiles="$srv_amd64_xmlfiles"
+			srv_mingw64=yes
+			srv_mingw=yes
+			;;
+
   xscale*-*-linux*)	srv_regobj=reg-arm.o
 			srv_tgtobj="linux-low.o linux-arm-low.o"
 			srv_linux_usrregs=yes
Index: gdbserver/win32-i386-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/win32-i386-low.c,v
retrieving revision 1.18
diff -u -p -r1.18 win32-i386-low.c
--- gdbserver/win32-i386-low.c	20 Jan 2010 22:55:38 -0000	1.18
+++ gdbserver/win32-i386-low.c	17 Apr 2010 22:08:35 -0000
@@ -15,205 +15,9 @@
    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 "server.h"
-#include "win32-low.h"
-#include "i386-low.h"
-
-#define FCS_REGNUM 27
-#define FOP_REGNUM 31
-
-#define FLAG_TRACE_BIT 0x100
-
 /* Defined in auto-generated file reg-i386.c.  */
 void init_registers_i386 (void);
 
-static struct i386_debug_reg_state debug_reg_state;
-
-static int debug_registers_changed = 0;
-static int debug_registers_used = 0;
-
-/* Update the inferior's debug register REGNUM from STATE.  */
-
-void
-i386_dr_low_set_addr (const struct i386_debug_reg_state *state, int regnum)
-{
-  if (! (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR))
-    fatal ("Invalid debug register %d", regnum);
-
-  /* debug_reg_state.dr_mirror is already set.
-     Just notify i386_set_thread_context, i386_thread_added
-     that the registers need to be updated.  */
-  debug_registers_changed = 1;
-  debug_registers_used = 1;
-}
-
-/* Update the inferior's DR7 debug control register from STATE.  */
-
-void
-i386_dr_low_set_control (const struct i386_debug_reg_state *state)
-{
-  /* debug_reg_state.dr_control_mirror is already set.
-     Just notify i386_set_thread_context, i386_thread_added
-     that the registers need to be updated.  */
-  debug_registers_changed = 1;
-  debug_registers_used = 1;
-}
-
-/* Get the value of the DR6 debug status register from the inferior
-   and record it in STATE.  */
-
-void
-i386_dr_low_get_status (struct i386_debug_reg_state *state)
-{
-  /* We don't need to do anything here, the last call to thread_rec for
-     current_event.dwThreadId id has already set it.  */
-}
-
-/* Watchpoint support.  */
-
-static int
-i386_insert_point (char type, CORE_ADDR addr, int len)
-{
-  switch (type)
-    {
-    case '2':
-    case '3':
-    case '4':
-      return i386_low_insert_watchpoint (&debug_reg_state,
-					 type, addr, len);
-    default:
-      /* Unsupported.  */
-      return 1;
-    }
-}
-
-static int
-i386_remove_point (char type, CORE_ADDR addr, int len)
-{
-  switch (type)
-    {
-    case '2':
-    case '3':
-    case '4':
-      return i386_low_remove_watchpoint (&debug_reg_state,
-					 type, addr, len);
-    default:
-      /* Unsupported.  */
-      return 1;
-    }
-}
-
-static int
-i386_stopped_by_watchpoint (void)
-{
-  return i386_low_stopped_by_watchpoint (&debug_reg_state);
-}
-
-static CORE_ADDR
-i386_stopped_data_address (void)
-{
-  CORE_ADDR addr;
-  if (i386_low_stopped_data_address (&debug_reg_state, &addr))
-    return addr;
-  return 0;
-}
-
-static void
-i386_initial_stuff (void)
-{
-  i386_low_init_dregs (&debug_reg_state);
-  debug_registers_changed = 0;
-  debug_registers_used = 0;
-}
-
-static void
-i386_get_thread_context (win32_thread_info *th, DEBUG_EVENT* current_event)
-{
-  /* Requesting the CONTEXT_EXTENDED_REGISTERS register set fails if
-     the system doesn't support extended registers.  */
-  static DWORD extended_registers = CONTEXT_EXTENDED_REGISTERS;
-
- again:
-  th->context.ContextFlags = (CONTEXT_FULL
-			      | CONTEXT_FLOATING_POINT
-			      | CONTEXT_DEBUG_REGISTERS
-			      | extended_registers);
-
-  if (!GetThreadContext (th->h, &th->context))
-    {
-      DWORD e = GetLastError ();
-
-      if (extended_registers && e == ERROR_INVALID_PARAMETER)
-	{
-	  extended_registers = 0;
-	  goto again;
-	}
-
-      error ("GetThreadContext failure %ld\n", (long) e);
-    }
-
-  debug_registers_changed = 0;
-
-  if (th->tid == current_event->dwThreadId)
-    {
-      /* Copy dr values from the current thread.  */
-      struct i386_debug_reg_state *dr = &debug_reg_state;
-      dr->dr_mirror[0] = th->context.Dr0;
-      dr->dr_mirror[1] = th->context.Dr1;
-      dr->dr_mirror[2] = th->context.Dr2;
-      dr->dr_mirror[3] = th->context.Dr3;
-      dr->dr_status_mirror = th->context.Dr6;
-      dr->dr_control_mirror = th->context.Dr7;
-    }
-}
-
-static void
-i386_set_thread_context (win32_thread_info *th, DEBUG_EVENT* current_event)
-{
-  if (debug_registers_changed)
-    {
-      struct i386_debug_reg_state *dr = &debug_reg_state;
-      th->context.Dr0 = dr->dr_mirror[0];
-      th->context.Dr1 = dr->dr_mirror[1];
-      th->context.Dr2 = dr->dr_mirror[2];
-      th->context.Dr3 = dr->dr_mirror[3];
-      /* th->context.Dr6 = dr->dr_status_mirror;
-	 FIXME: should we set dr6 also ?? */
-      th->context.Dr7 = dr->dr_control_mirror;
-    }
-
-  SetThreadContext (th->h, &th->context);
-}
-
-static void
-i386_thread_added (win32_thread_info *th)
-{
-  /* Set the debug registers for the new thread if they are used.  */
-  if (debug_registers_used)
-    {
-      struct i386_debug_reg_state *dr = &debug_reg_state;
-      th->context.ContextFlags = CONTEXT_DEBUG_REGISTERS;
-      GetThreadContext (th->h, &th->context);
-
-      th->context.Dr0 = dr->dr_mirror[0];
-      th->context.Dr1 = dr->dr_mirror[1];
-      th->context.Dr2 = dr->dr_mirror[2];
-      th->context.Dr3 = dr->dr_mirror[3];
-      /* th->context.Dr6 = dr->dr_status_mirror;
-	 FIXME: should we set dr6 also ?? */
-      th->context.Dr7 = dr->dr_control_mirror;
-
-      SetThreadContext (th->h, &th->context);
-      th->context.ContextFlags = 0;
-    }
-}
-
-static void
-i386_single_step (win32_thread_info *th)
-{
-  th->context.EFlags |= FLAG_TRACE_BIT;
-}
-
 /* An array of offset mappings into a Win32 Context structure.
    This is a one-to-one mapping which is indexed by gdb's register
    numbers.  It retrieves an offset into the context structure where
@@ -222,7 +26,7 @@ i386_single_step (win32_thread_info *th)
    register in it's CONTEXT structure.  In this case regptr will return
    a pointer into a dummy register.  */
 #define context_offset(x) ((int)&(((CONTEXT *)NULL)->x))
-static const int mappings[] = {
+static const int windows_i386_mappings[] = {
   context_offset (Eax),
   context_offset (Ecx),
   context_offset (Edx),
@@ -269,54 +73,13 @@ static const int mappings[] = {
 };
 #undef context_offset
 
-/* Fetch register from gdbserver regcache data.  */
-static void
-i386_fetch_inferior_register (struct regcache *regcache,
-			      win32_thread_info *th, int r)
-{
-  char *context_offset = (char *) &th->context + mappings[r];
-
-  long l;
-  if (r == FCS_REGNUM)
-    {
-      l = *((long *) context_offset) & 0xffff;
-      supply_register (regcache, r, (char *) &l);
-    }
-  else if (r == FOP_REGNUM)
-    {
-      l = (*((long *) context_offset) >> 16) & ((1 << 11) - 1);
-      supply_register (regcache, r, (char *) &l);
-    }
-  else
-    supply_register (regcache, r, context_offset);
-}
-
-/* Store a new register value into the thread context of TH.  */
 static void
-i386_store_inferior_register (struct regcache *regcache,
-			      win32_thread_info *th, int r)
+init_windows_x86 ()
 {
-  char *context_offset = (char *) &th->context + mappings[r];
-  collect_register (regcache, r, context_offset);
+  init_registers_i386 ();
+  mappings = windows_i386_mappings;
+  the_low_target.num_regs = sizeof (windows_i386_mappings)
+			    / sizeof (windows_i386_mappings[0]);
 }
 
-static const unsigned char i386_win32_breakpoint = 0xcc;
-#define i386_win32_breakpoint_len 1
 
-struct win32_target_ops the_low_target = {
-  init_registers_i386,
-  sizeof (mappings) / sizeof (mappings[0]),
-  i386_initial_stuff,
-  i386_get_thread_context,
-  i386_set_thread_context,
-  i386_thread_added,
-  i386_fetch_inferior_register,
-  i386_store_inferior_register,
-  i386_single_step,
-  &i386_win32_breakpoint,
-  i386_win32_breakpoint_len,
-  i386_insert_point,
-  i386_remove_point,
-  i386_stopped_by_watchpoint,
-  i386_stopped_data_address
-};
Index: gdbserver/win32-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/win32-low.c,v
retrieving revision 1.46
diff -u -p -r1.46 win32-low.c
--- gdbserver/win32-low.c	16 Apr 2010 07:49:37 -0000	1.46
+++ gdbserver/win32-low.c	17 Apr 2010 22:08:36 -0000
@@ -280,7 +280,7 @@ child_xfer_memory (CORE_ADDR memaddr, ch
 		   int write, struct target_ops *target)
 {
   SIZE_T done;
-  long addr = (long) memaddr;
+  uintptr_t addr = (uintptr_t) memaddr;
 
   if (write)
     {
@@ -941,7 +941,7 @@ get_image_name (HANDLE h, void *address,
   char *address_ptr;
   int len = 0;
   char b[2];
-  DWORD done;
+  SIZE_T done;
 
   /* Attempt to read the name of the dll that was detected.
      This is documented to work only when actively debugging
@@ -1019,7 +1019,7 @@ load_psapi (void)
 }
 
 static int
-psapi_get_dll_name (DWORD BaseAddress, char *dll_name_ret)
+psapi_get_dll_name (uintptr_t BaseAddress, char *dll_name_ret)
 {
   DWORD len;
   MODULEINFO mi;
@@ -1064,7 +1064,7 @@ psapi_get_dll_name (DWORD BaseAddress, c
 		 (int) err, strwinerror (err));
 	}
 
-      if ((DWORD) (mi.lpBaseOfDll) == BaseAddress)
+      if ((uintptr_t) (mi.lpBaseOfDll) == BaseAddress)
 	{
 	  len = (*win32_GetModuleFileNameExA) (current_process_handle,
 					       DllHandle[i],
@@ -1134,7 +1134,7 @@ load_toolhelp (void)
 }
 
 static int
-toolhelp_get_dll_name (DWORD BaseAddress, char *dll_name_ret)
+toolhelp_get_dll_name (uintptr_t BaseAddress, char *dll_name_ret)
 {
   HANDLE snapshot_module;
   MODULEENTRY32 modEntry = { sizeof (MODULEENTRY32) };
@@ -1151,7 +1151,7 @@ toolhelp_get_dll_name (DWORD BaseAddress
   /* Ignore the first module, which is the exe.  */
   if (win32_Module32First (snapshot_module, &modEntry))
     while (win32_Module32Next (snapshot_module, &modEntry))
-      if ((DWORD) modEntry.modBaseAddr == BaseAddress)
+      if ((uintptr_t) modEntry.modBaseAddr == BaseAddress)
 	{
 #ifdef UNICODE
 	  wcstombs (dll_name_ret, modEntry.szExePath, MAX_PATH + 1);
@@ -1176,21 +1176,21 @@ handle_load_dll (void)
   LOAD_DLL_DEBUG_INFO *event = &current_event.u.LoadDll;
   char dll_buf[MAX_PATH + 1];
   char *dll_name = NULL;
-  DWORD load_addr;
+  uintptr_t load_addr;
 
   dll_buf[0] = dll_buf[sizeof (dll_buf) - 1] = '\0';
 
   /* Windows does not report the image name of the dlls in the debug
      event on attaches.  We resort to iterating over the list of
      loaded dlls looking for a match by image base.  */
-  if (!psapi_get_dll_name ((DWORD) event->lpBaseOfDll, dll_buf))
+  if (!psapi_get_dll_name ((uintptr_t) event->lpBaseOfDll, dll_buf))
     {
       if (!server_waiting)
 	/* On some versions of Windows and Windows CE, we can't create
 	   toolhelp snapshots while the inferior is stopped in a
 	   LOAD_DLL_DEBUG_EVENT due to a dll load, but we can while
 	   Windows is reporting the already loaded dlls.  */
-	toolhelp_get_dll_name ((DWORD) event->lpBaseOfDll, dll_buf);
+	toolhelp_get_dll_name ((uintptr_t) event->lpBaseOfDll, dll_buf);
     }
 
   dll_name = dll_buf;
@@ -1205,7 +1205,7 @@ handle_load_dll (void)
      the offset from 0 of the first byte in an image - because
      of the file header and the section alignment. */
 
-  load_addr = (DWORD) event->lpBaseOfDll + 0x1000;
+  load_addr = (uintptr_t) event->lpBaseOfDll + 0x1000;
   win32_add_one_solib (dll_name, load_addr);
 }
 
@@ -1213,7 +1213,7 @@ static void
 handle_unload_dll (void)
 {
   CORE_ADDR load_addr =
-	  (CORE_ADDR) (DWORD) current_event.u.UnloadDll.lpBaseOfDll;
+	  (CORE_ADDR) (uintptr_t) current_event.u.UnloadDll.lpBaseOfDll;
   load_addr += 0x1000;
   unloaded_dll (NULL, load_addr);
 }
@@ -1314,10 +1314,10 @@ handle_exception (struct target_waitstat
 	  ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
 	  return;
 	}
-      OUTMSG2 (("gdbserver: unknown target exception 0x%08lx at 0x%08lx",
+      OUTMSG2 (("gdbserver: unknown target exception 0x%08lx at 0x%s",
 		current_event.u.Exception.ExceptionRecord.ExceptionCode,
-		(DWORD) current_event.u.Exception.ExceptionRecord.
-		ExceptionAddress));
+		phex_nz ((uintptr_t)
current_event.u.Exception.ExceptionRecord.
+		ExceptionAddress, sizeof(uintptr_t))));
       ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
       break;
     }
@@ -1577,7 +1577,6 @@ get_child_debug_event (struct target_wai
 static ptid_t
 win32_wait (ptid_t ptid, struct target_waitstatus *ourstatus, int options)
 {
-  struct process_info *process;
   struct regcache *regcache;
 
   while (1)
Index: gdbserver/win64-amd64-low.c
===================================================================
RCS file: gdbserver/win64-amd64-low.c
diff -N gdbserver/win64-amd64-low.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gdbserver/win64-amd64-low.c	17 Apr 2010 22:08:36 -0000
@@ -0,0 +1,98 @@
+/* Copyright (C) 2007, 2008, 2009, 2010 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/>.
*/
+
+/* Defined in auto-generated file reg-amd64.c.  */
+void init_registers_amd64 (void);
+
+#ifndef CONTEXT_EXTENDED_REGISTERS
+#define CONTEXT_EXTENDED_REGISTERS 0
+#endif
+
+#define context_offset(x) (offsetof (CONTEXT, x))
+static const int windows_amd64_mappings[] =
+{
+  context_offset (Rax),
+  context_offset (Rbx),
+  context_offset (Rcx),
+  context_offset (Rdx),
+  context_offset (Rsi),
+  context_offset (Rdi),
+  context_offset (Rbp),
+  context_offset (Rsp),
+  context_offset (R8),
+  context_offset (R9),
+  context_offset (R10),
+  context_offset (R11),
+  context_offset (R12),
+  context_offset (R13),
+  context_offset (R14),
+  context_offset (R15),
+  context_offset (Rip),
+  context_offset (EFlags),
+  context_offset (SegCs),
+  context_offset (SegSs),
+  context_offset (SegDs),
+  context_offset (SegEs),
+  context_offset (SegFs),
+  context_offset (SegGs),
+  context_offset (FloatSave.FloatRegisters[0]),
+  context_offset (FloatSave.FloatRegisters[1]),
+  context_offset (FloatSave.FloatRegisters[2]),
+  context_offset (FloatSave.FloatRegisters[3]),
+  context_offset (FloatSave.FloatRegisters[4]),
+  context_offset (FloatSave.FloatRegisters[5]),
+  context_offset (FloatSave.FloatRegisters[6]),
+  context_offset (FloatSave.FloatRegisters[7]),
+  context_offset (FloatSave.ControlWord),
+  context_offset (FloatSave.StatusWord),
+  context_offset (FloatSave.TagWord),
+  context_offset (FloatSave.ErrorSelector),
+  context_offset (FloatSave.ErrorOffset),
+  context_offset (FloatSave.DataSelector),
+  context_offset (FloatSave.DataOffset),
+  context_offset (FloatSave.ErrorSelector)
+  /* XMM0-7 */ ,
+  context_offset (Xmm0),
+  context_offset (Xmm1),
+  context_offset (Xmm2),
+  context_offset (Xmm3),
+  context_offset (Xmm4),
+  context_offset (Xmm5),
+  context_offset (Xmm6),
+  context_offset (Xmm7),
+  context_offset (Xmm8),
+  context_offset (Xmm9),
+  context_offset (Xmm10),
+  context_offset (Xmm11),
+  context_offset (Xmm12),
+  context_offset (Xmm13),
+  context_offset (Xmm14),
+  context_offset (Xmm15),
+  /* MXCSR */
+  context_offset (FloatSave.MxCsr)
+};
+#undef context_offset
+
+static void
+init_windows_x86 ()
+{
+  init_registers_amd64 ();
+  mappings = windows_amd64_mappings;
+  the_low_target.num_regs = sizeof (windows_amd64_mappings)
+			    / sizeof (windows_amd64_mappings[0]);
+}
+
Index: gdbserver/windows-x86-low.c
===================================================================
RCS file: gdbserver/windows-x86-low.c
diff -N gdbserver/windows-x86-low.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gdbserver/windows-x86-low.c	17 Apr 2010 22:08:36 -0000
@@ -0,0 +1,272 @@
+/* Copyright (C) 2007, 2008, 2009, 2010 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 "server.h"
+#include "win32-low.h"
+#include "i386-low.h"
+
+static const int *mappings;
+
+#ifdef COMPILE_WIN64
+#include "win64-amd64-low.c"
+#else
+#include "win32-i386-low.c"
+#endif
+
+#define FCS_REGNUM 27
+#define FOP_REGNUM 31
+
+#define FLAG_TRACE_BIT 0x100
+
+static struct i386_debug_reg_state debug_reg_state;
+
+static int debug_registers_changed = 0;
+static int debug_registers_used = 0;
+
+/* Update the inferior's debug register REGNUM from STATE.  */
+
+void
+i386_dr_low_set_addr (const struct i386_debug_reg_state *state, int regnum)
+{
+  if (! (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR))
+    fatal ("Invalid debug register %d", regnum);
+
+  /* debug_reg_state.dr_mirror is already set.
+     Just notify i386_set_thread_context, i386_thread_added
+     that the registers need to be updated.  */
+  debug_registers_changed = 1;
+  debug_registers_used = 1;
+}
+
+/* Update the inferior's DR7 debug control register from STATE.  */
+
+void
+i386_dr_low_set_control (const struct i386_debug_reg_state *state)
+{
+  /* debug_reg_state.dr_control_mirror is already set.
+     Just notify i386_set_thread_context, i386_thread_added
+     that the registers need to be updated.  */
+  debug_registers_changed = 1;
+  debug_registers_used = 1;
+}
+
+/* Get the value of the DR6 debug status register from the inferior
+   and record it in STATE.  */
+
+void
+i386_dr_low_get_status (struct i386_debug_reg_state *state)
+{
+  /* We don't need to do anything here, the last call to thread_rec for
+     current_event.dwThreadId id has already set it.  */
+}
+
+/* Watchpoint support.  */
+
+static int
+i386_insert_point (char type, CORE_ADDR addr, int len)
+{
+  switch (type)
+    {
+    case '2':
+    case '3':
+    case '4':
+      return i386_low_insert_watchpoint (&debug_reg_state,
+					 type, addr, len);
+    default:
+      /* Unsupported.  */
+      return 1;
+    }
+}
+
+static int
+i386_remove_point (char type, CORE_ADDR addr, int len)
+{
+  switch (type)
+    {
+    case '2':
+    case '3':
+    case '4':
+      return i386_low_remove_watchpoint (&debug_reg_state,
+					 type, addr, len);
+    default:
+      /* Unsupported.  */
+      return 1;
+    }
+}
+
+static int
+i386_stopped_by_watchpoint (void)
+{
+  return i386_low_stopped_by_watchpoint (&debug_reg_state);
+}
+
+static CORE_ADDR
+i386_stopped_data_address (void)
+{
+  CORE_ADDR addr;
+  if (i386_low_stopped_data_address (&debug_reg_state, &addr))
+    return addr;
+  return 0;
+}
+
+static void
+i386_initial_stuff (void)
+{
+  i386_low_init_dregs (&debug_reg_state);
+  debug_registers_changed = 0;
+  debug_registers_used = 0;
+}
+
+static void
+i386_get_thread_context (win32_thread_info *th, DEBUG_EVENT* current_event)
+{
+  /* Requesting the CONTEXT_EXTENDED_REGISTERS register set fails if
+     the system doesn't support extended registers.  */
+  static DWORD extended_registers = CONTEXT_EXTENDED_REGISTERS;
+
+ again:
+  th->context.ContextFlags = (CONTEXT_FULL
+			      | CONTEXT_FLOATING_POINT
+			      | CONTEXT_DEBUG_REGISTERS
+			      | extended_registers);
+
+  if (!GetThreadContext (th->h, &th->context))
+    {
+      DWORD e = GetLastError ();
+
+      if (extended_registers && e == ERROR_INVALID_PARAMETER)
+	{
+	  extended_registers = 0;
+	  goto again;
+	}
+
+      error ("GetThreadContext failure %ld\n", (long) e);
+    }
+
+  debug_registers_changed = 0;
+
+  if (th->tid == current_event->dwThreadId)
+    {
+      /* Copy dr values from the current thread.  */
+      struct i386_debug_reg_state *dr = &debug_reg_state;
+      dr->dr_mirror[0] = th->context.Dr0;
+      dr->dr_mirror[1] = th->context.Dr1;
+      dr->dr_mirror[2] = th->context.Dr2;
+      dr->dr_mirror[3] = th->context.Dr3;
+      dr->dr_status_mirror = th->context.Dr6;
+      dr->dr_control_mirror = th->context.Dr7;
+    }
+}
+
+static void
+i386_set_thread_context (win32_thread_info *th, DEBUG_EVENT* current_event)
+{
+  if (debug_registers_changed)
+    {
+      struct i386_debug_reg_state *dr = &debug_reg_state;
+      th->context.Dr0 = dr->dr_mirror[0];
+      th->context.Dr1 = dr->dr_mirror[1];
+      th->context.Dr2 = dr->dr_mirror[2];
+      th->context.Dr3 = dr->dr_mirror[3];
+      /* th->context.Dr6 = dr->dr_status_mirror;
+	 FIXME: should we set dr6 also ?? */
+      th->context.Dr7 = dr->dr_control_mirror;
+    }
+
+  SetThreadContext (th->h, &th->context);
+}
+
+static void
+i386_thread_added (win32_thread_info *th)
+{
+  /* Set the debug registers for the new thread if they are used.  */
+  if (debug_registers_used)
+    {
+      struct i386_debug_reg_state *dr = &debug_reg_state;
+      th->context.ContextFlags = CONTEXT_DEBUG_REGISTERS;
+      GetThreadContext (th->h, &th->context);
+
+      th->context.Dr0 = dr->dr_mirror[0];
+      th->context.Dr1 = dr->dr_mirror[1];
+      th->context.Dr2 = dr->dr_mirror[2];
+      th->context.Dr3 = dr->dr_mirror[3];
+      /* th->context.Dr6 = dr->dr_status_mirror;
+	 FIXME: should we set dr6 also ?? */
+      th->context.Dr7 = dr->dr_control_mirror;
+
+      SetThreadContext (th->h, &th->context);
+      th->context.ContextFlags = 0;
+    }
+}
+
+static void
+i386_single_step (win32_thread_info *th)
+{
+  th->context.EFlags |= FLAG_TRACE_BIT;
+}
+
+/* Fetch register from gdbserver regcache data.  */
+static void
+i386_fetch_inferior_register (struct regcache *regcache,
+			      win32_thread_info *th, int r)
+{
+  char *context_offset = (char *) &th->context + mappings[r];
+
+  long l;
+  if (r == FCS_REGNUM)
+    {
+      l = *((long *) context_offset) & 0xffff;
+      supply_register (regcache, r, (char *) &l);
+    }
+  else if (r == FOP_REGNUM)
+    {
+      l = (*((long *) context_offset) >> 16) & ((1 << 11) - 1);
+      supply_register (regcache, r, (char *) &l);
+    }
+  else
+    supply_register (regcache, r, context_offset);
+}
+
+/* Store a new register value into the thread context of TH.  */
+static void
+i386_store_inferior_register (struct regcache *regcache,
+			      win32_thread_info *th, int r)
+{
+  char *context_offset = (char *) &th->context + mappings[r];
+  collect_register (regcache, r, context_offset);
+}
+
+static const unsigned char i386_win32_breakpoint = 0xcc;
+#define i386_win32_breakpoint_len 1
+
+struct win32_target_ops the_low_target = {
+  init_windows_x86,
+  0, /* Filled in init_windows_x86 function.  */ 
+  i386_initial_stuff,
+  i386_get_thread_context,
+  i386_set_thread_context,
+  i386_thread_added,
+  i386_fetch_inferior_register,
+  i386_store_inferior_register,
+  i386_single_step,
+  &i386_win32_breakpoint,
+  i386_win32_breakpoint_len,
+  i386_insert_point,
+  i386_remove_point,
+  i386_stopped_by_watchpoint,
+  i386_stopped_data_address
+};


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [RFC-v2] Mingw Windows 64-bit gdbserver
  2010-04-17 23:18       ` [RFC-v2] " Pierre Muller
@ 2010-04-17 23:46         ` Pedro Alves
  2010-04-19  6:37           ` [RFA] Prepare for " Pierre Muller
       [not found]           ` <6200558430975530197@unknownmsgid>
  0 siblings, 2 replies; 16+ messages in thread
From: Pedro Alves @ 2010-04-17 23:46 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches

On Sunday 18 April 2010 00:17:59, Pierre Muller wrote:
> 
> > -----Message d'origine-----
> > De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> > owner@sourceware.org] De la part de Pedro Alves
> > Envoyé : Saturday, April 17, 2010 12:58 PM
> > À : Pierre Muller
> > Cc : gdb-patches@sourceware.org
> > Objet : Re: [RFC] Mingw Windows 64-bit gdbserver
> > 
> > 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.
> 
>   Here is a new version of the patch:
> I tried to minimize code duplication, but I
> still needed one macro to decide which file
> from win32-i386-low.c or win64-amd64-low.c 
> should be read.

Sorry, this is a no-no.  Please reread what I said.  Do
not include ".c" files.  If you want to take a route like
that (have a define to select between 64-bit and 32-bit),
might as well merge the i386 and amd64 bits all within the
same file, just like I suggested from the beggining, and
use `ifdef __x86_64__'.

>   The ChangeLog is a bit messy because I renamed a file
> and reused the old name to create a new file...
> but I didn't find another name that would fit better...
> Unless I use windows- as a prefix everywhere...

I think is would be simpler for both of us if you split out this
patch into smaller pieces.  Fix the type casts in win32-low.c,
one piece.  Renaming a file, and adjusting
configure/makefile, another piece.  Splitting out i?86 bits
and amd64 windows bits to their own files, another piece
(though I still wonder why not merge all of that into
one file, but I admit that I no longer know what
is best).

This change:

> -srv_amd64_regobj="amd64.o x86-64-avx.o"
> +srv_amd64_regobj="amd64.o amd64-avx.o"

looks like another piece.  Is it just a cosmetic change because
we use amd64 instead of x86-64 throughout?  Please explain
it and post it separately, if possible.

Etc., etc.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [RFA] Prepare for  Mingw Windows 64-bit gdbserver
  2010-04-17 23:46         ` Pedro Alves
@ 2010-04-19  6:37           ` Pierre Muller
       [not found]           ` <6200558430975530197@unknownmsgid>
  1 sibling, 0 replies; 16+ messages in thread
From: Pierre Muller @ 2010-04-19  6:37 UTC (permalink / raw)
  To: hjl; +Cc: 'Pedro Alves', gdb-patches

> > -srv_amd64_regobj="amd64.o x86-64-avx.o"
> > +srv_amd64_regobj="amd64.o amd64-avx.o"
> 
> looks like another piece.  Is it just a cosmetic change because
> we use amd64 instead of x86-64 throughout?  Please explain
> it and post it separately, if possible.

  I suspect that this is an error in the commit
from H.J. Lu dated 2010/04/07.

  The ChangeLog says:
        * configure.srv (srv_i386_regobj): Add i386-avx.o.
        (srv_i386_linux_regobj): Add i386-avx-linux.o.
        (srv_amd64_regobj): Add amd64-avx.o.

But 
$ cvs diff -r 1.51 -r 1.52 configure.srv
Index: configure.srv
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/configure.srv,v
retrieving revision 1.51
retrieving revision 1.52
diff -r1.51 -r1.52
25,28c25,28
< srv_i386_regobj=i386.o
< srv_i386_linux_regobj=i386-linux.o
< srv_amd64_regobj=amd64.o
< srv_amd64_linux_regobj=amd64-linux.o
---
> srv_i386_regobj="i386.o i386-avx.o"
> srv_i386_linux_regobj="i386-linux.o i386-avx-linux.o"
> srv_amd64_regobj="amd64.o x86-64-avx.o"
> srv_amd64_linux_regobj="amd64-linux.o amd64-avx-linux.o"
30,35c30,35

As srv_amd64_regobj is not yet used, nobody noticed it before
I tried to use it for mingw64 support.

Is this OK?

Pierre

PS: I will try to send the patch into several sub-patches,
but I am still not used to handling patch series ...


ChangeLog entry:
2010-04-19  Pierre Muller  <muller@ics.u-strasbg.fr>

	* configure.srv (srv_amd64_regobj): Replace `x86-64-avx.o' by
`amd64-avx.o'.

Index: configure.srv
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/configure.srv,v
retrieving revision 1.53
diff -u -p -r1.53 configure.srv
--- configure.srv       8 Apr 2010 22:32:38 -0000       1.53
+++ configure.srv       18 Apr 2010 15:34:29 -0000
@@ -24,7 +24,7 @@ srv_hostio_err_objs="hostio-errno.o"

 srv_i386_regobj="i386.o i386-avx.o i386-mmx.o"
 srv_i386_linux_regobj="i386-linux.o i386-avx-linux.o i386-mmx-linux.o"
-srv_amd64_regobj="amd64.o x86-64-avx.o"
+srv_amd64_regobj="amd64.o amd64-avx.o"
 srv_amd64_linux_regobj="amd64-linux.o amd64-avx-linux.o"

 srv_i386_32bit_xmlfiles="i386/32bit-core.xml i386/32bit-sse.xml
i386/32bit-avx.xml"



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [RFA] Prepare for Mingw Windows 64-bit gdbserver
       [not found]           ` <6200558430975530197@unknownmsgid>
@ 2010-04-19 13:56             ` H.J. Lu
  2010-04-19 14:13               ` Pierre Muller
  0 siblings, 1 reply; 16+ messages in thread
From: H.J. Lu @ 2010-04-19 13:56 UTC (permalink / raw)
  To: Pierre Muller; +Cc: Pedro Alves, gdb-patches

On Sun, Apr 18, 2010 at 11:37 PM, Pierre Muller
<pierre.muller@ics-cnrs.unistra.fr> wrote:
>> > -srv_amd64_regobj="amd64.o x86-64-avx.o"
>> > +srv_amd64_regobj="amd64.o amd64-avx.o"
>>
>> looks like another piece.  Is it just a cosmetic change because
>> we use amd64 instead of x86-64 throughout?  Please explain
>> it and post it separately, if possible.
>
>  I suspect that this is an error in the commit
> from H.J. Lu dated 2010/04/07.
>
>  The ChangeLog says:
>        * configure.srv (srv_i386_regobj): Add i386-avx.o.
>        (srv_i386_linux_regobj): Add i386-avx-linux.o.
>        (srv_amd64_regobj): Add amd64-avx.o.
>

That was a typo. Thanks for fixing it.

-- 
H.J.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [RFA] Prepare for Mingw Windows 64-bit gdbserver
  2010-04-19 13:56             ` H.J. Lu
@ 2010-04-19 14:13               ` Pierre Muller
  0 siblings, 0 replies; 16+ messages in thread
From: Pierre Muller @ 2010-04-19 14:13 UTC (permalink / raw)
  To: 'H.J. Lu'; +Cc: 'Pedro Alves', gdb-patches

> <pierre.muller@ics-cnrs.unistra.fr> wrote:
> >> > -srv_amd64_regobj="amd64.o x86-64-avx.o"
> >> > +srv_amd64_regobj="amd64.o amd64-avx.o"
> >>
> >> looks like another piece.  Is it just a cosmetic change because
> >> we use amd64 instead of x86-64 throughout?  Please explain
> >> it and post it separately, if possible.
> >
> >  I suspect that this is an error in the commit
> > from H.J. Lu dated 2010/04/07.
> >
> >  The ChangeLog says:
> >        * configure.srv (srv_i386_regobj): Add i386-avx.o.
> >        (srv_i386_linux_regobj): Add i386-avx-linux.o.
> >        (srv_amd64_regobj): Add amd64-avx.o.
> >
> 
> That was a typo. Thanks for fixing it.

  Committed,

Pierre


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2010-04-19 14:13 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-16 15:32 [RFC] Mingw Windows 64-bit gdbserver Pierre Muller
2010-04-16 15:59 ` Pedro Alves
2010-04-16 16:20   ` Pierre Muller
2010-04-16 16:27     ` Pedro Alves
2010-04-16 16:38       ` Pierre Muller
2010-04-16 17:15         ` Pedro Alves
2010-04-17  5:39           ` [RFA] Use winsock2 for mingw gdbserver Pierre Muller
2010-04-17  8:28             ` Pedro Alves
2010-04-17 20:44               ` Pierre Muller
2010-04-17  5:40   ` [RFC] Mingw Windows 64-bit gdbserver Pierre Muller
2010-04-17 10:58     ` Pedro Alves
2010-04-17 23:18       ` [RFC-v2] " Pierre Muller
2010-04-17 23:46         ` Pedro Alves
2010-04-19  6:37           ` [RFA] Prepare for " Pierre Muller
     [not found]           ` <6200558430975530197@unknownmsgid>
2010-04-19 13:56             ` H.J. Lu
2010-04-19 14:13               ` Pierre Muller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox