public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb, gdbserver: remove WinCE support code
@ 2021-04-10 23:10 Simon Marchi
  2021-04-12 11:42 ` Pedro Alves
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Simon Marchi @ 2021-04-10 23:10 UTC (permalink / raw)
  To: gdb-patches

The support for WinCE was removed with commit 84b300de3666 ("gdbserver:
remove support for ARM/WinCE").  There is some leftover code for WinCE
support, guarded by the _WIN32_WCE macro, which I didn't know of at the
time.

I didn't remove the _WIN32_WCE references in the tests, because in
theory we still support the WinCE architecture in GDB (when debugging
remotely).  So someone could run a test with that (although I'd be
really surprised).

gdb/ChangeLog:

	* nat/windows-nat.c: Remove all code guarded by _WIN32_WCE.
	* nat/windows-nat.h: Likewise.

gdbserver/ChangeLog:

	* win32-low.cc: Remove all code guarded by _WIN32_WCE.
	* win32-low.h: Likewise.

Change-Id: I7a871b897e2135dc195b10690bff2a01d9fac05a
---
 gdb/nat/windows-nat.c  |  11 ---
 gdb/nat/windows-nat.h  |   5 --
 gdbserver/win32-low.cc | 176 ++---------------------------------------
 gdbserver/win32-low.h  |   4 -
 4 files changed, 5 insertions(+), 191 deletions(-)

diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c
index 659a75663ae4..794e2df85baf 100644
--- a/gdb/nat/windows-nat.c
+++ b/gdb/nat/windows-nat.c
@@ -117,11 +117,6 @@ get_image_name (HANDLE h, void *address, int unicode)
   if (address == NULL)
     return NULL;
 
-#ifdef _WIN32_WCE
-  /* Windows CE reports the address of the image name,
-     instead of an address of a pointer into the image name.  */
-  address_ptr = address;
-#else
   /* See if we could read the address of a string, and that the
      address isn't null.  */
   if (!ReadProcessMemory (h, address,  &address_ptr,
@@ -129,7 +124,6 @@ get_image_name (HANDLE h, void *address, int unicode)
       || done != sizeof (address_ptr)
       || !address_ptr)
     return NULL;
-#endif
 
   /* Find the length of the string.  */
   while (ReadProcessMemory (h, address_ptr + len++ * size, &b, size, &done)
@@ -262,11 +256,6 @@ handle_exception (struct target_waitstatus *ourstatus, bool debug_exceptions)
     case STATUS_WX86_BREAKPOINT:
       DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_BREAKPOINT");
       ourstatus->value.sig = GDB_SIGNAL_TRAP;
-#ifdef _WIN32_WCE
-      /* Remove the initial breakpoint.  */
-      check_breakpoints ((CORE_ADDR) (long) current_event
-			 .u.Exception.ExceptionRecord.ExceptionAddress);
-#endif
       break;
     case DBG_CONTROL_C:
       DEBUG_EXCEPTION_SIMPLE ("DBG_CONTROL_C");
diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h
index 84f6505e4c74..d8aeaa4b9845 100644
--- a/gdb/nat/windows-nat.h
+++ b/gdb/nat/windows-nat.h
@@ -67,11 +67,6 @@ struct windows_thread_info
      was not.  */
   int suspended = 0;
 
-#ifdef _WIN32_WCE
-  /* The context as retrieved right after suspending the thread. */
-  CONTEXT base_context {};
-#endif
-
   /* The context of the thread, including any manipulations.  */
   union
   {
diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc
index 1f319a251b4d..4789949fa431 100644
--- a/gdbserver/win32-low.cc
+++ b/gdbserver/win32-low.cc
@@ -62,13 +62,8 @@ using namespace windows_nat;
 #define COUNTOF(STR) (sizeof (STR) / sizeof ((STR)[0]))
 #endif
 
-#ifdef _WIN32_WCE
-# define GETPROCADDRESS(DLL, PROC) \
-  ((winapi_ ## PROC) GetProcAddress (DLL, TEXT (#PROC)))
-#else
-# define GETPROCADDRESS(DLL, PROC) \
+#define GETPROCADDRESS(DLL, PROC) \
   ((winapi_ ## PROC) GetProcAddress (DLL, #PROC))
-#endif
 
 int using_threads = 1;
 
@@ -111,9 +106,7 @@ winapi_Wow64GetThreadContext win32_Wow64GetThreadContext;
 static winapi_Wow64SetThreadContext win32_Wow64SetThreadContext;
 #endif
 
-#ifndef _WIN32_WCE
 static void win32_add_all_dlls (void);
-#endif
 
 /* Get the thread ID from the current selected inferior (the current
    thread).  */
@@ -142,9 +135,6 @@ win32_get_thread_context (windows_thread_info *th)
 #endif
     memset (&th->context, 0, sizeof (CONTEXT));
   (*the_low_target.get_thread_context) (th);
-#ifdef _WIN32_WCE
-  memcpy (&th->base_context, &th->context, sizeof (CONTEXT));
-#endif
 }
 
 /* Set the thread context of the thread associated with TH.  */
@@ -152,27 +142,12 @@ win32_get_thread_context (windows_thread_info *th)
 static void
 win32_set_thread_context (windows_thread_info *th)
 {
-#ifdef _WIN32_WCE
-  /* Calling SuspendThread on a thread that is running kernel code
-     will report that the suspending was successful, but in fact, that
-     will often not be true.  In those cases, the context returned by
-     GetThreadContext will not be correct by the time the thread
-     stops, hence we can't set that context back into the thread when
-     resuming - it will most likely crash the inferior.
-     Unfortunately, there is no way to know when the thread will
-     really stop.  To work around it, we'll only write the context
-     back to the thread when either the user or GDB explicitly change
-     it between stopping and resuming.  */
-  if (memcmp (&th->context, &th->base_context, sizeof (CONTEXT)) != 0)
-#endif
-    {
 #ifdef __x86_64__
-      if (wow64_process)
-	win32_Wow64SetThreadContext (th->h, &th->wow64_context);
-      else
+  if (wow64_process)
+    win32_Wow64SetThreadContext (th->h, &th->wow64_context);
+  else
 #endif
-	SetThreadContext (th->h, &th->context);
-    }
+    SetThreadContext (th->h, &th->context);
 }
 
 /* Set the thread context of the thread associated with TH.  */
@@ -445,7 +420,6 @@ do_initial_child_stuff (HANDLE proch, DWORD pid, int attached)
       }
     }
 
-#ifndef _WIN32_WCE
   /* Now that the inferior has been started and all DLLs have been mapped,
      we can iterate over all DLLs and load them in.
 
@@ -462,7 +436,6 @@ do_initial_child_stuff (HANDLE proch, DWORD pid, int attached)
      simpler to just ignore DLL load/unload events during the startup
      phase, and then process them all in one batch now.  */
   win32_add_all_dlls ();
-#endif
 
   child_initialization_done = 1;
 }
@@ -611,46 +584,6 @@ create_process (const char *program, char *args,
   proglen = strlen (program) + 1;
   argslen = strlen (args) + proglen;
 
-#ifdef _WIN32_WCE
-  wchar_t *p, *wprogram, *wargs, *wcwd = NULL;
-
-  wprogram = (wchar_t *) alloca (proglen * sizeof (wchar_t));
-  mbstowcs (wprogram, program, proglen);
-
-  for (p = wprogram; *p; ++p)
-    if (L'/' == *p)
-      *p = L'\\';
-
-  wargs = alloca ((argslen + 1) * sizeof (wchar_t));
-  wcscpy (wargs, wprogram);
-  wcscat (wargs, L" ");
-  mbstowcs (wargs + proglen, args, argslen + 1 - proglen);
-
-  if (inferior_cwd != NULL)
-    {
-      std::string expanded_infcwd = gdb_tilde_expand (inferior_cwd);
-      std::replace (expanded_infcwd.begin (), expanded_infcwd.end (),
-		    '/', '\\');
-      wcwd = alloca ((expanded_infcwd.size () + 1) * sizeof (wchar_t));
-      if (mbstowcs (wcwd, expanded_infcwd.c_str (),
-		    expanded_infcwd.size () + 1) == NULL)
-	{
-	  error (_("\
-Could not convert the expanded inferior cwd to wide-char."));
-	}
-    }
-
-  ret = CreateProcessW (wprogram, /* image name */
-			wargs,    /* command line */
-			NULL,     /* security, not supported */
-			NULL,     /* thread, not supported */
-			FALSE,    /* inherit handles, not supported */
-			flags,    /* start flags */
-			NULL,     /* environment, not supported */
-			wcwd,     /* current directory */
-			NULL,     /* start info, not supported */
-			pi);      /* proc info */
-#else
   STARTUPINFOA si = { sizeof (STARTUPINFOA) };
   char *program_and_args = (char *) alloca (argslen + 1);
 
@@ -670,7 +603,6 @@ Could not convert the expanded inferior cwd to wide-char."));
 			 : gdb_tilde_expand (inferior_cwd).c_str()),
 			&si,               /* start info */
 			pi);               /* proc info */
-#endif
 
   return ret;
 }
@@ -751,12 +683,7 @@ win32_process_target::create_inferior (const char *program,
       OUTMSG2 (("Process created: %s %s\n", program, (char *) args));
     }
 
-#ifndef _WIN32_WCE
-  /* On Windows CE this handle can't be closed.  The OS reuses
-     it in the debug events, while the 9x/NT versions of Windows
-     probably use a DuplicateHandle'd one.  */
   CloseHandle (pi.hThread);
-#endif
 
   do_initial_child_stuff (pi.hProcess, pi.dwProcessId, 0);
 
@@ -779,11 +706,7 @@ win32_process_target::attach (unsigned long pid)
   HANDLE h;
   winapi_DebugSetProcessKillOnExit DebugSetProcessKillOnExit = NULL;
   DWORD err;
-#ifdef _WIN32_WCE
-  HMODULE dll = GetModuleHandle (_T("COREDLL.DLL"));
-#else
   HMODULE dll = GetModuleHandle (_T("KERNEL32.DLL"));
-#endif
   DebugSetProcessKillOnExit = GETPROCADDRESS (dll, DebugSetProcessKillOnExit);
 
   h = OpenProcess (PROCESS_ALL_ACCESS, FALSE, pid);
@@ -901,11 +824,7 @@ win32_process_target::detach (process_info *process)
 {
   winapi_DebugActiveProcessStop DebugActiveProcessStop = NULL;
   winapi_DebugSetProcessKillOnExit DebugSetProcessKillOnExit = NULL;
-#ifdef _WIN32_WCE
-  HMODULE dll = GetModuleHandle (_T("COREDLL.DLL"));
-#else
   HMODULE dll = GetModuleHandle (_T("KERNEL32.DLL"));
-#endif
   DebugActiveProcessStop = GETPROCADDRESS (dll, DebugActiveProcessStop);
   DebugSetProcessKillOnExit = GETPROCADDRESS (dll, DebugSetProcessKillOnExit);
 
@@ -1056,15 +975,8 @@ win32_add_one_solib (const char *name, CORE_ADDR load_addr)
   char buf[MAX_PATH + 1];
   char buf2[MAX_PATH + 1];
 
-#ifdef _WIN32_WCE
-  WIN32_FIND_DATA w32_fd;
-  WCHAR wname[MAX_PATH + 1];
-  mbstowcs (wname, name, MAX_PATH);
-  HANDLE h = FindFirstFile (wname, &w32_fd);
-#else
   WIN32_FIND_DATAA w32_fd;
   HANDLE h = FindFirstFileA (name, &w32_fd);
-#endif
 
   /* The symbols in a dll are offset by 0x1000, which is the
      offset from 0 of the first byte in an image - because
@@ -1077,7 +989,6 @@ win32_add_one_solib (const char *name, CORE_ADDR load_addr)
     {
       FindClose (h);
       strcpy (buf, name);
-#ifndef _WIN32_WCE
       {
 	char cwd[MAX_PATH + 1];
 	char *p;
@@ -1091,16 +1002,13 @@ win32_add_one_solib (const char *name, CORE_ADDR load_addr)
 	    SetCurrentDirectoryA (cwd);
 	  }
       }
-#endif
     }
 
-#ifndef _WIN32_WCE
   if (strcasecmp (buf, "ntdll.dll") == 0)
     {
       GetSystemDirectoryA (buf, sizeof (buf));
       strcat (buf, "\\ntdll.dll");
     }
-#endif
 
 #ifdef __CYGWIN__
   cygwin_conv_path (CCP_WIN_A_TO_POSIX, buf, buf2, sizeof (buf2));
@@ -1163,8 +1071,6 @@ load_psapi (void)
 	  && win32_GetModuleFileNameExA != NULL);
 }
 
-#ifndef _WIN32_WCE
-
 /* Iterate over all DLLs currently mapped by our inferior, and
    add them to our list of solibs.  */
 
@@ -1282,7 +1188,6 @@ win32_add_all_dlls (void)
       win32_add_one_solib (name, (CORE_ADDR) (uintptr_t) mi.lpBaseOfDll);
     }
 }
-#endif
 
 typedef HANDLE (WINAPI *winapi_CreateToolhelp32Snapshot) (DWORD, DWORD);
 typedef BOOL (WINAPI *winapi_Module32First) (HANDLE, LPMODULEENTRY32);
@@ -1343,14 +1248,6 @@ fake_breakpoint_event (void)
   for_each_thread (suspend_one_thread);
 }
 
-#ifdef _WIN32_WCE
-static int
-auto_delete_breakpoint (CORE_ADDR stop_pc)
-{
-  return 1;
-}
-#endif
-
 /* See nat/windows-nat.h.  */
 
 bool
@@ -1696,11 +1593,7 @@ win32_process_target::request_interrupt ()
   winapi_DebugBreakProcess DebugBreakProcess;
   winapi_GenerateConsoleCtrlEvent GenerateConsoleCtrlEvent;
 
-#ifdef _WIN32_WCE
-  HMODULE dll = GetModuleHandle (_T("COREDLL.DLL"));
-#else
   HMODULE dll = GetModuleHandle (_T("KERNEL32.DLL"));
-#endif
 
   GenerateConsoleCtrlEvent = GETPROCADDRESS (dll, GenerateConsoleCtrlEvent);
 
@@ -1729,65 +1622,6 @@ win32_process_target::supports_hardware_single_step ()
   return true;
 }
 
-#ifdef _WIN32_WCE
-int
-win32_error_to_fileio_error (DWORD err)
-{
-  switch (err)
-    {
-    case ERROR_BAD_PATHNAME:
-    case ERROR_FILE_NOT_FOUND:
-    case ERROR_INVALID_NAME:
-    case ERROR_PATH_NOT_FOUND:
-      return FILEIO_ENOENT;
-    case ERROR_CRC:
-    case ERROR_IO_DEVICE:
-    case ERROR_OPEN_FAILED:
-      return FILEIO_EIO;
-    case ERROR_INVALID_HANDLE:
-      return FILEIO_EBADF;
-    case ERROR_ACCESS_DENIED:
-    case ERROR_SHARING_VIOLATION:
-      return FILEIO_EACCES;
-    case ERROR_NOACCESS:
-      return FILEIO_EFAULT;
-    case ERROR_BUSY:
-      return FILEIO_EBUSY;
-    case ERROR_ALREADY_EXISTS:
-    case ERROR_FILE_EXISTS:
-      return FILEIO_EEXIST;
-    case ERROR_BAD_DEVICE:
-      return FILEIO_ENODEV;
-    case ERROR_DIRECTORY:
-      return FILEIO_ENOTDIR;
-    case ERROR_FILENAME_EXCED_RANGE:
-    case ERROR_INVALID_DATA:
-    case ERROR_INVALID_PARAMETER:
-    case ERROR_NEGATIVE_SEEK:
-      return FILEIO_EINVAL;
-    case ERROR_TOO_MANY_OPEN_FILES:
-      return FILEIO_EMFILE;
-    case ERROR_HANDLE_DISK_FULL:
-    case ERROR_DISK_FULL:
-      return FILEIO_ENOSPC;
-    case ERROR_WRITE_PROTECT:
-      return FILEIO_EROFS;
-    case ERROR_NOT_SUPPORTED:
-      return FILEIO_ENOSYS;
-    }
-
-  return FILEIO_EUNKNOWN;
-}
-
-void
-win32_process_target::hostio_last_error (char *buf)
-{
-  DWORD winerr = GetLastError ();
-  int fileio_err = win32_error_to_fileio_error (winerr);
-  sprintf (buf, "F-1,%x", fileio_err);
-}
-#endif
-
 bool
 win32_process_target::supports_qxfer_siginfo ()
 {
diff --git a/gdbserver/win32-low.h b/gdbserver/win32-low.h
index 81946612cefa..fce19e49dec9 100644
--- a/gdbserver/win32-low.h
+++ b/gdbserver/win32-low.h
@@ -142,10 +142,6 @@ class win32_process_target : public process_stratum_target
 
   CORE_ADDR stopped_data_address () override;
 
-#ifdef _WIN32_WCE
-  void hostio_last_error (char *buf) override;
-#endif
-
   bool supports_qxfer_siginfo () override;
 
   int qxfer_siginfo (const char *annex, unsigned char *readbuf,
-- 
2.30.1


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

* Re: [PATCH] gdb, gdbserver: remove WinCE support code
  2021-04-10 23:10 [PATCH] gdb, gdbserver: remove WinCE support code Simon Marchi
@ 2021-04-12 11:42 ` Pedro Alves
  2021-04-12 15:12   ` Simon Marchi
  2021-04-12 13:57 ` [PATCH] gdb, gdbserver: remove WinCE support code Luis Machado
  2021-04-13 19:29 ` Tom Tromey
  2 siblings, 1 reply; 14+ messages in thread
From: Pedro Alves @ 2021-04-12 11:42 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 11/04/21 00:10, Simon Marchi via Gdb-patches wrote:
> The support for WinCE was removed with commit 84b300de3666 ("gdbserver:
> remove support for ARM/WinCE").  There is some leftover code for WinCE
> support, guarded by the _WIN32_WCE macro, which I didn't know of at the
> time.
> 
> I didn't remove the _WIN32_WCE references in the tests, because in
> theory we still support the WinCE architecture in GDB (when debugging
> remotely).  So someone could run a test with that (although I'd be
> really surprised).
> 
> gdb/ChangeLog:
> 
> 	* nat/windows-nat.c: Remove all code guarded by _WIN32_WCE.
> 	* nat/windows-nat.h: Likewise.
> 
> gdbserver/ChangeLog:
> 
> 	* win32-low.cc: Remove all code guarded by _WIN32_WCE.
> 	* win32-low.h: Likewise.

OK.

We can also get rid of the whole 

  the_target->hostio_last_error / hostio-errno.cc / hostio_last_error_from_errno

abstraction now.

Thanks,
Pedro Alves

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

* Re: [PATCH] gdb, gdbserver: remove WinCE support code
  2021-04-10 23:10 [PATCH] gdb, gdbserver: remove WinCE support code Simon Marchi
  2021-04-12 11:42 ` Pedro Alves
@ 2021-04-12 13:57 ` Luis Machado
  2021-04-12 14:01   ` Simon Marchi
  2021-04-13 19:29 ` Tom Tromey
  2 siblings, 1 reply; 14+ messages in thread
From: Luis Machado @ 2021-04-12 13:57 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 4/10/21 8:10 PM, Simon Marchi via Gdb-patches wrote:
> The support for WinCE was removed with commit 84b300de3666 ("gdbserver:
> remove support for ARM/WinCE").  There is some leftover code for WinCE
> support, guarded by the _WIN32_WCE macro, which I didn't know of at the
> time.
> 
> I didn't remove the _WIN32_WCE references in the tests, because in
> theory we still support the WinCE architecture in GDB (when debugging
> remotely).  So someone could run a test with that (although I'd be
> really surprised).

Is there value in supporting remote-based debugging of WinCE if we're 
dropping gdbserver support? Should we also drop the GDB and testing 
parts given this won't likely be exercised anytime soon if there's no 
maintainer?

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

* Re: [PATCH] gdb, gdbserver: remove WinCE support code
  2021-04-12 13:57 ` [PATCH] gdb, gdbserver: remove WinCE support code Luis Machado
@ 2021-04-12 14:01   ` Simon Marchi
  2021-04-12 14:07     ` Luis Machado
  0 siblings, 1 reply; 14+ messages in thread
From: Simon Marchi @ 2021-04-12 14:01 UTC (permalink / raw)
  To: Luis Machado, gdb-patches

On 2021-04-12 9:57 a.m., Luis Machado wrote:> On 4/10/21 8:10 PM, Simon Marchi via Gdb-patches wrote:
>> The support for WinCE was removed with commit 84b300de3666 ("gdbserver:
>> remove support for ARM/WinCE").  There is some leftover code for WinCE
>> support, guarded by the _WIN32_WCE macro, which I didn't know of at the
>> time.
>>
>> I didn't remove the _WIN32_WCE references in the tests, because in
>> theory we still support the WinCE architecture in GDB (when debugging
>> remotely).  So someone could run a test with that (although I'd be
>> really surprised).
> 
> Is there value in supporting remote-based debugging of WinCE if we're dropping gdbserver support? Should we also drop the GDB and testing parts given this won't likely be exercised anytime soon if there's no maintainer?

I don't think so.  After doing that cleanup of stale arches in
GDBserver, I wanted to do the same for GDB, but didn't really finish it.

Simon

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

* Re: [PATCH] gdb, gdbserver: remove WinCE support code
  2021-04-12 14:01   ` Simon Marchi
@ 2021-04-12 14:07     ` Luis Machado
  0 siblings, 0 replies; 14+ messages in thread
From: Luis Machado @ 2021-04-12 14:07 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 4/12/21 11:01 AM, Simon Marchi wrote:
> On 2021-04-12 9:57 a.m., Luis Machado wrote:> On 4/10/21 8:10 PM, Simon Marchi via Gdb-patches wrote:
>>> The support for WinCE was removed with commit 84b300de3666 ("gdbserver:
>>> remove support for ARM/WinCE").  There is some leftover code for WinCE
>>> support, guarded by the _WIN32_WCE macro, which I didn't know of at the
>>> time.
>>>
>>> I didn't remove the _WIN32_WCE references in the tests, because in
>>> theory we still support the WinCE architecture in GDB (when debugging
>>> remotely).  So someone could run a test with that (although I'd be
>>> really surprised).
>>
>> Is there value in supporting remote-based debugging of WinCE if we're dropping gdbserver support? Should we also drop the GDB and testing parts given this won't likely be exercised anytime soon if there's no maintainer?
> 
> I don't think so.  After doing that cleanup of stale arches in
> GDBserver, I wanted to do the same for GDB, but didn't really finish it.

Understood. I'm not saying you should do the work, but it is good to 
know that it can be done by whoever has some spare cycles to come up 
with the cleanup (myself included).

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

* Re: [PATCH] gdb, gdbserver: remove WinCE support code
  2021-04-12 11:42 ` Pedro Alves
@ 2021-04-12 15:12   ` Simon Marchi
  2021-04-12 15:24     ` Simon Marchi
  0 siblings, 1 reply; 14+ messages in thread
From: Simon Marchi @ 2021-04-12 15:12 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 2021-04-12 7:42 a.m., Pedro Alves wrote:
> On 11/04/21 00:10, Simon Marchi via Gdb-patches wrote:
>> The support for WinCE was removed with commit 84b300de3666 ("gdbserver:
>> remove support for ARM/WinCE").  There is some leftover code for WinCE
>> support, guarded by the _WIN32_WCE macro, which I didn't know of at the
>> time.
>>
>> I didn't remove the _WIN32_WCE references in the tests, because in
>> theory we still support the WinCE architecture in GDB (when debugging
>> remotely).  So someone could run a test with that (although I'd be
>> really surprised).
>>
>> gdb/ChangeLog:
>>
>> 	* nat/windows-nat.c: Remove all code guarded by _WIN32_WCE.
>> 	* nat/windows-nat.h: Likewise.
>>
>> gdbserver/ChangeLog:
>>
>> 	* win32-low.cc: Remove all code guarded by _WIN32_WCE.
>> 	* win32-low.h: Likewise.
> 
> OK.
> 
> We can also get rid of the whole 
> 
>   the_target->hostio_last_error / hostio-errno.cc / hostio_last_error_from_errno
> 
> abstraction now.

Ok, I didn't really know what that was for.  I pushed the patch and will
send a follow up for that.

Simon

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

* Re: [PATCH] gdb, gdbserver: remove WinCE support code
  2021-04-12 15:12   ` Simon Marchi
@ 2021-04-12 15:24     ` Simon Marchi
  2021-04-12 22:20       ` [PATCH] Remove process_stratum_target::hostio_last_error abstraction (Re: [PATCH] gdb, gdbserver: remove WinCE support code) Pedro Alves
  0 siblings, 1 reply; 14+ messages in thread
From: Simon Marchi @ 2021-04-12 15:24 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 2021-04-12 11:12 a.m., Simon Marchi via Gdb-patches wrote:
> On 2021-04-12 7:42 a.m., Pedro Alves wrote:
>> On 11/04/21 00:10, Simon Marchi via Gdb-patches wrote:
>>> The support for WinCE was removed with commit 84b300de3666 ("gdbserver:
>>> remove support for ARM/WinCE").  There is some leftover code for WinCE
>>> support, guarded by the _WIN32_WCE macro, which I didn't know of at the
>>> time.
>>>
>>> I didn't remove the _WIN32_WCE references in the tests, because in
>>> theory we still support the WinCE architecture in GDB (when debugging
>>> remotely).  So someone could run a test with that (although I'd be
>>> really surprised).
>>>
>>> gdb/ChangeLog:
>>>
>>> 	* nat/windows-nat.c: Remove all code guarded by _WIN32_WCE.
>>> 	* nat/windows-nat.h: Likewise.
>>>
>>> gdbserver/ChangeLog:
>>>
>>> 	* win32-low.cc: Remove all code guarded by _WIN32_WCE.
>>> 	* win32-low.h: Likewise.
>>
>> OK.
>>
>> We can also get rid of the whole 
>>
>>   the_target->hostio_last_error / hostio-errno.cc / hostio_last_error_from_errno
>>
>> abstraction now.
> 
> Ok, I didn't really know what that was for.  I pushed the patch and will
> send a follow up for that.
> 
> Simon

Well, I spoke too soon, I don't really understand what abstraction you
are talking about.

Simon

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

* [PATCH] Remove process_stratum_target::hostio_last_error abstraction (Re: [PATCH] gdb, gdbserver: remove WinCE support code)
  2021-04-12 15:24     ` Simon Marchi
@ 2021-04-12 22:20       ` Pedro Alves
  2021-04-12 22:52         ` Pedro Alves
  2021-04-12 23:56         ` Simon Marchi
  0 siblings, 2 replies; 14+ messages in thread
From: Pedro Alves @ 2021-04-12 22:20 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 12/04/21 16:24, Simon Marchi wrote:
> On 2021-04-12 11:12 a.m., Simon Marchi via Gdb-patches wrote:
>> On 2021-04-12 7:42 a.m., Pedro Alves wrote:

>>> We can also get rid of the whole 
>>>
>>>   the_target->hostio_last_error / hostio-errno.cc / hostio_last_error_from_errno
>>>
>>> abstraction now.
>>
>> Ok, I didn't really know what that was for.  I pushed the patch and will
>> send a follow up for that.

> 
> Well, I spoke too soon, I don't really understand what abstraction you
> are talking about.


This.

From 6a3ffc7e3f65799402078dc9c0721eeb33fc19c9 Mon Sep 17 00:00:00 2001
From: Pedro Alves <pedro@palves.net>
Date: Mon, 12 Apr 2021 20:23:54 +0100
Subject: [PATCH] Remove process_stratum_target::hostio_last_error abstraction

Now that the WinCE port is gone, all ports map host I/O errors from
errno, so this abstraction is no longer necessary.

Basically undoes:
  https://sourceware.org/pipermail/gdb-patches/2008-January/055246.html
  https://sourceware.org/pipermail/gdb-patches/attachments/20080131/f44e7012/attachment.bin

gdbserver/ChangeLog:

	* Makefile.in (SFILES): Remove hostio-errno.cc.
	* configure: Regenerate.
	* configure.ac (GDBSERVER_DEPFILES): No longer add
	$srv_hostio_err_objs.
	* configure.srv (srv_hostio_err_objs): Delete.
	* hostio-errno.cc: Delete.
	* hostio.cc (hostio_error): Inline hostio_last_error_from_errno
	here.
	* hostio.h (hostio_last_error_from_errno): Delete.
	* target.cc (process_stratum_target::hostio_last_error): Delete.
	* target.h (class process_stratum_target) <hostio_last_error>:
	Delete.
---
 gdbserver/Makefile.in     |  1 -
 gdbserver/configure       |  2 +-
 gdbserver/configure.ac    |  2 +-
 gdbserver/configure.srv   |  5 -----
 gdbserver/hostio-errno.cc | 36 ------------------------------------
 gdbserver/hostio.cc       |  8 +++++---
 gdbserver/hostio.h        |  4 ----
 gdbserver/target.cc       |  6 ------
 gdbserver/target.h        |  4 ----
 9 files changed, 7 insertions(+), 61 deletions(-)
 delete mode 100644 gdbserver/hostio-errno.cc

diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
index a05cd1a57ad..f7ade7d61d5 100644
--- a/gdbserver/Makefile.in
+++ b/gdbserver/Makefile.in
@@ -186,7 +186,6 @@ SFILES = \
 	$(srcdir)/dll.cc \
 	$(srcdir)/gdbreplay.cc \
 	$(srcdir)/hostio.cc \
-	$(srcdir)/hostio-errno.cc \
 	$(srcdir)/i387-fp.cc \
 	$(srcdir)/inferiors.cc \
 	$(srcdir)/linux-aarch64-low.cc \
diff --git a/gdbserver/configure b/gdbserver/configure
index 0db0ad3f4fb..032b4ae65bb 100755
--- a/gdbserver/configure
+++ b/gdbserver/configure
@@ -10633,7 +10633,7 @@ $as_echo "#define USE_XML 1" >>confdefs.h
   done
 fi
 
-GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_hostio_err_objs $srv_thread_depfiles"
+GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_thread_depfiles"
 GDBSERVER_LIBS="$srv_libs"
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target supports __sync_*_compare_and_swap" >&5
diff --git a/gdbserver/configure.ac b/gdbserver/configure.ac
index 6c504777d09..5ec222dfc60 100644
--- a/gdbserver/configure.ac
+++ b/gdbserver/configure.ac
@@ -379,7 +379,7 @@ if test "$srv_xmlfiles" != ""; then
   done
 fi
 
-GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_hostio_err_objs $srv_thread_depfiles"
+GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_thread_depfiles"
 GDBSERVER_LIBS="$srv_libs"
 
 dnl Check whether the target supports __sync_*_compare_and_swap.
diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv
index 2dd8f75a4e0..971f537bffa 100644
--- a/gdbserver/configure.srv
+++ b/gdbserver/configure.srv
@@ -8,8 +8,6 @@
 #   srv_regobj		The register protocol appropriate for this target.
 #   srv_tgtobj		Any other target-specific modules appropriate
 #			for this target.
-#   srv_hostio_err	The object implementing the hostio_last_error
-#			target method.
 #   srv_xmlfiles	All XML files which should be available for
 #			gdbserver in this configuration.
 #   ipa_obj		Any other target-specific modules appropriate
@@ -24,9 +22,6 @@
 #   srv_linux_usrregs	Set to "yes" if we can get at registers via
 #			PTRACE_PEEKUSR / PTRACE_POKEUSR.
 
-# Default hostio_last_error implementation
-srv_hostio_err_objs="hostio-errno.o"
-
 ipa_ppc_linux_regobj="powerpc-32l-ipa.o powerpc-altivec32l-ipa.o powerpc-vsx32l-ipa.o powerpc-isa205-32l-ipa.o powerpc-isa205-altivec32l-ipa.o powerpc-isa205-vsx32l-ipa.o powerpc-isa205-ppr-dscr-vsx32l-ipa.o powerpc-isa207-vsx32l-ipa.o powerpc-isa207-htm-vsx32l-ipa.o powerpc-e500l-ipa.o powerpc-64l-ipa.o powerpc-altivec64l-ipa.o powerpc-vsx64l-ipa.o powerpc-isa205-64l-ipa.o powerpc-isa205-altivec64l-ipa.o powerpc-isa205-vsx64l-ipa.o powerpc-isa205-ppr-dscr-vsx64l-ipa.o powerpc-isa207-vsx64l-ipa.o powerpc-isa207-htm-vsx64l-ipa.o"
 
 # Linux object files.  This is so we don't have to repeat
diff --git a/gdbserver/hostio-errno.cc b/gdbserver/hostio-errno.cc
deleted file mode 100644
index 4cb3922b92e..00000000000
--- a/gdbserver/hostio-errno.cc
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Host file transfer support for gdbserver.
-   Copyright (C) 2007-2021 Free Software Foundation, Inc.
-
-   Contributed by CodeSourcery.
-
-   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/>.  */
-
-/* This file implements the hostio_last_error target callback
-   on top of errno.  */
-
-#include "server.h"
-
-#include "hostio.h"
-
-#include "gdbsupport/fileio.h"
-
-void
-hostio_last_error_from_errno (char *buf)
-{
-  int error = errno;
-  int fileio_error = host_to_fileio_error (error);
-  sprintf (buf, "F-1,%x", fileio_error);
-}
diff --git a/gdbserver/hostio.cc b/gdbserver/hostio.cc
index 26c0f119d20..0654bba3a6f 100644
--- a/gdbserver/hostio.cc
+++ b/gdbserver/hostio.cc
@@ -191,12 +191,14 @@ require_valid_fd (int fd)
   return -1;
 }
 
-/* Fill in own_buf with the last hostio error packet, however it
-   suitable for the target.  */
+/* Fill BUF with an hostio error packet representing the last hostio
+   error, from errno.  */
+
 static void
 hostio_error (char *own_buf)
 {
-  the_target->hostio_last_error (own_buf);
+  int fileio_error = host_to_fileio_error (errno);
+  sprintf (own_buf, "F-1,%x", fileio_error);
 }
 
 static void
diff --git a/gdbserver/hostio.h b/gdbserver/hostio.h
index 61c42196e54..97c27c6b744 100644
--- a/gdbserver/hostio.h
+++ b/gdbserver/hostio.h
@@ -22,10 +22,6 @@
 /* Per-connection setup.  */
 extern void hostio_handle_new_gdb_connection (void);
 
-/* Functions from hostio.c.  */
 extern int handle_vFile (char *, int, int *);
 
-/* Functions from hostio-errno.c.  */
-extern void hostio_last_error_from_errno (char *own_buf);
-
 #endif /* GDBSERVER_HOSTIO_H */
diff --git a/gdbserver/target.cc b/gdbserver/target.cc
index 5ec3e5cce9f..6660cc04fd5 100644
--- a/gdbserver/target.cc
+++ b/gdbserver/target.cc
@@ -505,12 +505,6 @@ process_stratum_target::get_tls_address (thread_info *thread,
   gdb_assert_not_reached ("target op get_tls_address not supported");
 }
 
-void
-process_stratum_target::hostio_last_error (char *buf)
-{
-  hostio_last_error_from_errno (buf);
-}
-
 bool
 process_stratum_target::supports_qxfer_osdata ()
 {
diff --git a/gdbserver/target.h b/gdbserver/target.h
index 769d8281176..2c4393ec8c6 100644
--- a/gdbserver/target.h
+++ b/gdbserver/target.h
@@ -256,10 +256,6 @@ class process_stratum_target
   virtual int get_tls_address (thread_info *thread, CORE_ADDR offset,
 			       CORE_ADDR load_module, CORE_ADDR *address);
 
-  /* Fill BUF with an hostio error packet representing the last hostio
-     error.  */
-  virtual void hostio_last_error (char *buf);
-
   /* Return true if the qxfer_osdata target op is supported.  */
   virtual bool supports_qxfer_osdata ();
 

base-commit: 4bb920c68e3a9e310095d54e0c4034c9cee12916
-- 
2.26.2


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

* Re: [PATCH] Remove process_stratum_target::hostio_last_error abstraction (Re: [PATCH] gdb, gdbserver: remove WinCE support code)
  2021-04-12 22:20       ` [PATCH] Remove process_stratum_target::hostio_last_error abstraction (Re: [PATCH] gdb, gdbserver: remove WinCE support code) Pedro Alves
@ 2021-04-12 22:52         ` Pedro Alves
  2021-04-12 23:56         ` Simon Marchi
  1 sibling, 0 replies; 14+ messages in thread
From: Pedro Alves @ 2021-04-12 22:52 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 12/04/21 23:20, Pedro Alves wrote:

> Basically undoes:
>   https://sourceware.org/pipermail/gdb-patches/2008-January/055246.html

Sorry, wrong URL here, I meant this one:

  https://sourceware.org/pipermail/gdb-patches/2008-January/055511.html

>   https://sourceware.org/pipermail/gdb-patches/attachments/20080131/f44e7012/attachment.bin
> 


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

* Re: [PATCH] Remove process_stratum_target::hostio_last_error abstraction (Re: [PATCH] gdb, gdbserver: remove WinCE support code)
  2021-04-12 22:20       ` [PATCH] Remove process_stratum_target::hostio_last_error abstraction (Re: [PATCH] gdb, gdbserver: remove WinCE support code) Pedro Alves
  2021-04-12 22:52         ` Pedro Alves
@ 2021-04-12 23:56         ` Simon Marchi
  2021-04-13 13:12           ` Pedro Alves
  1 sibling, 1 reply; 14+ messages in thread
From: Simon Marchi @ 2021-04-12 23:56 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

On 2021-04-12 6:20 p.m., Pedro Alves wrote:> On 12/04/21 16:24, Simon Marchi wrote:
>> On 2021-04-12 11:12 a.m., Simon Marchi via Gdb-patches wrote:
>>> On 2021-04-12 7:42 a.m., Pedro Alves wrote:
> 
>>>> We can also get rid of the whole 
>>>>
>>>>   the_target->hostio_last_error / hostio-errno.cc / hostio_last_error_from_errno
>>>>
>>>> abstraction now.
>>>
>>> Ok, I didn't really know what that was for.  I pushed the patch and will
>>> send a follow up for that.
> 
>>
>> Well, I spoke too soon, I don't really understand what abstraction you
>> are talking about.
> 
> 
> This.
> 
> From 6a3ffc7e3f65799402078dc9c0721eeb33fc19c9 Mon Sep 17 00:00:00 2001
> From: Pedro Alves <pedro@palves.net>
> Date: Mon, 12 Apr 2021 20:23:54 +0100
> Subject: [PATCH] Remove process_stratum_target::hostio_last_error abstraction
> 
> Now that the WinCE port is gone, all ports map host I/O errors from
> errno, so this abstraction is no longer necessary.
> 
> Basically undoes:
>   https://sourceware.org/pipermail/gdb-patches/2008-January/055246.html
>   https://sourceware.org/pipermail/gdb-patches/attachments/20080131/f44e7012/attachment.bin
> 
> gdbserver/ChangeLog:
> 
> 	* Makefile.in (SFILES): Remove hostio-errno.cc.
> 	* configure: Regenerate.
> 	* configure.ac (GDBSERVER_DEPFILES): No longer add
> 	$srv_hostio_err_objs.
> 	* configure.srv (srv_hostio_err_objs): Delete.
> 	* hostio-errno.cc: Delete.
> 	* hostio.cc (hostio_error): Inline hostio_last_error_from_errno
> 	here.
> 	* hostio.h (hostio_last_error_from_errno): Delete.
> 	* target.cc (process_stratum_target::hostio_last_error): Delete.
> 	* target.h (class process_stratum_target) <hostio_last_error>:
> 	Delete.

OK, I see.  Well, that LGTM!

Simon

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

* Re: [PATCH] Remove process_stratum_target::hostio_last_error abstraction (Re: [PATCH] gdb, gdbserver: remove WinCE support code)
  2021-04-12 23:56         ` Simon Marchi
@ 2021-04-13 13:12           ` Pedro Alves
  0 siblings, 0 replies; 14+ messages in thread
From: Pedro Alves @ 2021-04-13 13:12 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 13/04/21 00:56, Simon Marchi wrote:
> On 2021-04-12 6:20 p.m., Pedro Alves wrote:> On 12/04/21 16:24, Simon Marchi wrote:

>>> Well, I spoke too soon, I don't really understand what abstraction you
>>> are talking about.
>>
>>
>> This.

> OK, I see.  Well, that LGTM!

Merged then.  Thanks!

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

* Re: [PATCH] gdb, gdbserver: remove WinCE support code
  2021-04-10 23:10 [PATCH] gdb, gdbserver: remove WinCE support code Simon Marchi
  2021-04-12 11:42 ` Pedro Alves
  2021-04-12 13:57 ` [PATCH] gdb, gdbserver: remove WinCE support code Luis Machado
@ 2021-04-13 19:29 ` Tom Tromey
  2021-04-13 21:14   ` Pedro Alves
  2 siblings, 1 reply; 14+ messages in thread
From: Tom Tromey @ 2021-04-13 19:29 UTC (permalink / raw)
  To: Simon Marchi via Gdb-patches

>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> The support for WinCE was removed with commit 84b300de3666 ("gdbserver:
Simon> remove support for ARM/WinCE").  There is some leftover code for WinCE
Simon> support, guarded by the _WIN32_WCE macro, which I didn't know of at the
Simon> time.

I found one more spot, let me know what you think of the appended.

Tom

commit 765c5c546656b1a8012cf78d75aab644451d6d3e
Author: Tom Tromey <tromey@adacore.com>
Date:   Tue Apr 13 13:25:53 2021 -0600

    Remove use of _WIN32_WCE
    
    This removes the one last use of _WIN32_WCE from gdbserver.
    
    gdbserver/ChangeLog
    2021-04-13  Tom Tromey  <tromey@adacore.com>
    
            * win32-low.cc (windows_nat::handle_load_dll): Don't check
            _WIN32_WCE.

diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog
index ff008151421..e85fa775d7a 100644
--- a/gdbserver/ChangeLog
+++ b/gdbserver/ChangeLog
@@ -1,3 +1,8 @@
+2021-04-13  Tom Tromey  <tromey@adacore.com>
+
+	* win32-low.cc (windows_nat::handle_load_dll): Don't check
+	_WIN32_WCE.
+
 2021-04-13  Tom Tromey  <tromey@adacore.com>
 
 	* win32-low.cc (winapi_CreateToolhelp32Snapshot)
diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc
index 6502d857732..39a6848307a 100644
--- a/gdbserver/win32-low.cc
+++ b/gdbserver/win32-low.cc
@@ -1221,11 +1221,9 @@ windows_nat::handle_load_dll ()
 
   dll_name = get_image_name (current_process_handle,
 			     event->lpImageName, event->fUnicode);
-#ifndef _WIN32_WCE
   if (dll_name == nullptr
       && event->lpBaseOfDll != nullptr)
     dll_name = win32_add_dll (event->lpBaseOfDll);
-#endif
   if (dll_name == nullptr)
     return;
 

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

* Re: [PATCH] gdb, gdbserver: remove WinCE support code
  2021-04-13 19:29 ` Tom Tromey
@ 2021-04-13 21:14   ` Pedro Alves
  2021-04-13 21:20     ` [pushed] Remove WinCE code from gdbreplay Pedro Alves
  0 siblings, 1 reply; 14+ messages in thread
From: Pedro Alves @ 2021-04-13 21:14 UTC (permalink / raw)
  To: Tom Tromey, Simon Marchi via Gdb-patches

On 13/04/21 20:29, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Simon> The support for WinCE was removed with commit 84b300de3666 ("gdbserver:
> Simon> remove support for ARM/WinCE").  There is some leftover code for WinCE
> Simon> support, guarded by the _WIN32_WCE macro, which I didn't know of at the
> Simon> time.
> 
> I found one more spot, let me know what you think of the appended.

OK.  Obvious, even.

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

* [pushed] Remove WinCE code from gdbreplay
  2021-04-13 21:14   ` Pedro Alves
@ 2021-04-13 21:20     ` Pedro Alves
  0 siblings, 0 replies; 14+ messages in thread
From: Pedro Alves @ 2021-04-13 21:20 UTC (permalink / raw)
  To: Tom Tromey, Simon Marchi via Gdb-patches

On 13/04/21 22:14, Pedro Alves wrote:
> On 13/04/21 20:29, Tom Tromey wrote:
>>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
>>
>> Simon> The support for WinCE was removed with commit 84b300de3666 ("gdbserver:
>> Simon> remove support for ARM/WinCE").  There is some leftover code for WinCE
>> Simon> support, guarded by the _WIN32_WCE macro, which I didn't know of at the
>> Simon> time.
>>
>> I found one more spot, let me know what you think of the appended.
> 
> OK.  Obvious, even.
> 

I remembered to grep for MINGW32CE, and found some more in gdbreplay.  I've pushed this.

From 6cacd44948d844b035b359a3d65f575c9d7d7aed Mon Sep 17 00:00:00 2001
From: Pedro Alves <pedro@palves.net>
Date: Mon, 12 Apr 2021 20:23:54 +0100
Subject: [PATCH] Remove WinCE code from gdbreplay

gdbserver/ChangeLog:

	* gdbreplay.c [__MINGW32CE__] (COUNTOF, errno, strerror): Remove.
---
 gdbserver/ChangeLog    |  4 ++++
 gdbserver/gdbreplay.cc | 51 ------------------------------------------
 2 files changed, 4 insertions(+), 51 deletions(-)

diff --git a/gdbserver/gdbreplay.cc b/gdbserver/gdbreplay.cc
index 864a31e58f7..3705e9bf45f 100644
--- a/gdbserver/gdbreplay.cc
+++ b/gdbserver/gdbreplay.cc
@@ -69,57 +69,6 @@ typedef int socklen_t;
 static int remote_desc_in;
 static int remote_desc_out;
 
-#ifdef __MINGW32CE__
-
-#ifndef COUNTOF
-#define COUNTOF(STR) (sizeof (STR) / sizeof ((STR)[0]))
-#endif
-
-#define errno (GetLastError ())
-
-char *
-strerror (DWORD error)
-{
-  static char buf[1024];
-  WCHAR *msgbuf;
-  DWORD lasterr = GetLastError ();
-  DWORD chars = FormatMessageW (FORMAT_MESSAGE_FROM_SYSTEM
-				| FORMAT_MESSAGE_ALLOCATE_BUFFER,
-				NULL,
-				error,
-				0, /* Default language */
-				(LPVOID)&msgbuf,
-				0,
-				NULL);
-  if (chars != 0)
-    {
-      /* If there is an \r\n appended, zap it.  */
-      if (chars >= 2
-	  && msgbuf[chars - 2] == '\r'
-	  && msgbuf[chars - 1] == '\n')
-	{
-	  chars -= 2;
-	  msgbuf[chars] = 0;
-	}
-
-      if (chars > ((COUNTOF (buf)) - 1))
-	{
-	  chars = COUNTOF (buf) - 1;
-	  msgbuf [chars] = 0;
-	}
-
-      wcstombs (buf, msgbuf, chars + 1);
-      LocalFree (msgbuf);
-    }
-  else
-    sprintf (buf, "unknown win32 error (%ld)", error);
-
-  SetLastError (lasterr);
-  return buf;
-}
-
-#endif /* __MINGW32CE__ */
-
 static void
 sync_error (FILE *fp, const char *desc, int expect, int got)
 {

base-commit: 1228cb9094f17c3b151bcb087dcdf2c1cb05ae13
-- 
2.26.2


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

end of thread, other threads:[~2021-04-13 21:20 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-10 23:10 [PATCH] gdb, gdbserver: remove WinCE support code Simon Marchi
2021-04-12 11:42 ` Pedro Alves
2021-04-12 15:12   ` Simon Marchi
2021-04-12 15:24     ` Simon Marchi
2021-04-12 22:20       ` [PATCH] Remove process_stratum_target::hostio_last_error abstraction (Re: [PATCH] gdb, gdbserver: remove WinCE support code) Pedro Alves
2021-04-12 22:52         ` Pedro Alves
2021-04-12 23:56         ` Simon Marchi
2021-04-13 13:12           ` Pedro Alves
2021-04-12 13:57 ` [PATCH] gdb, gdbserver: remove WinCE support code Luis Machado
2021-04-12 14:01   ` Simon Marchi
2021-04-12 14:07     ` Luis Machado
2021-04-13 19:29 ` Tom Tromey
2021-04-13 21:14   ` Pedro Alves
2021-04-13 21:20     ` [pushed] Remove WinCE code from gdbreplay Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).