[pushed] Remove WinCE code from gdbreplay

Pedro Alves pedro@palves.net
Tue Apr 13 21:20:25 GMT 2021


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



More information about the Gdb-patches mailing list