From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id tbnnA2YwcmDAWQAAWB0awg (envelope-from ) for ; Sat, 10 Apr 2021 19:10:30 -0400 Received: by simark.ca (Postfix, from userid 112) id F3EC61EE1B; Sat, 10 Apr 2021 19:10:29 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 2B5711E590 for ; Sat, 10 Apr 2021 19:10:28 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AF5EA3839C41; Sat, 10 Apr 2021 23:10:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AF5EA3839C41 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1618096227; bh=jPSQJMchKfYZtvsGNtsiAnysFyem/D9WrLBDMfzAedE=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=ekHFVzokPnWqxd0DKtNKYPKmPLREA6LSD3vev9Hpma5KpQGxYGQS4QUr9ylQ/VOR1 ekENwZPxuVbGp5CmyoIv5R3kjb1hdN4sWddU8MlfrnhixE3PZ2lvS/hdXZg4pQt2gA pDvBDqcwJluccgNx4ok8vHGC+gIfZkPVspwsaBPk= Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id 41E6A3839C41 for ; Sat, 10 Apr 2021 23:10:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 41E6A3839C41 X-ASG-Debug-ID: 1618096221-0c856e67e2c9b2e0001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id 07XpHQNpkDg9UuMl (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 10 Apr 2021 19:10:22 -0400 (EDT) X-Barracuda-Envelope-From: simon.marchi@polymtl.ca X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from simark.localdomain (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) by smtp.ebox.ca (Postfix) with ESMTP id E7A82441B21; Sat, 10 Apr 2021 19:10:21 -0400 (EDT) X-Barracuda-RBL-IP: 192.222.157.6 X-Barracuda-Effective-Source-IP: 192-222-157-6.qc.cable.ebox.net[192.222.157.6] X-Barracuda-Apparent-Source-IP: 192.222.157.6 To: gdb-patches@sourceware.org Subject: [PATCH] gdb, gdbserver: remove WinCE support code Date: Sat, 10 Apr 2021 19:10:21 -0400 X-ASG-Orig-Subj: [PATCH] gdb, gdbserver: remove WinCE support code Message-Id: <20210410231021.1232451-1-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1618096222 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Barracuda-BRTS-Status: 1 X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 13854 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.89158 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces@sourceware.org Sender: "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