public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Various Cygwin build fixes
@ 2022-05-21 11:10 Jon Turney
  2022-05-21 11:10 ` [PATCH 1/4] Fix Cygwin build after fcab5839 Jon Turney
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Jon Turney @ 2022-05-21 11:10 UTC (permalink / raw)
  To: gdb-patches; +Cc: Jon Turney

Jon Turney (4):
  Fix Cygwin build after fcab5839
  Fix Cygwin build after 0578e87f
  Fix Cygwin build after 85b25bd9
  Fix a new warning on Cygwin

 gdb/nat/windows-nat.c | 11 +++++++++--
 gdb/windows-nat.c     | 15 ++++++---------
 2 files changed, 15 insertions(+), 11 deletions(-)

-- 
2.36.1


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

* [PATCH 1/4] Fix Cygwin build after fcab5839
  2022-05-21 11:10 [PATCH 0/4] Various Cygwin build fixes Jon Turney
@ 2022-05-21 11:10 ` Jon Turney
  2022-05-21 11:10 ` [PATCH 2/4] Fix Cygwin build after 0578e87f Jon Turney
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jon Turney @ 2022-05-21 11:10 UTC (permalink / raw)
  To: gdb-patches; +Cc: Jon Turney

Fix Cygwin build after fcab5839 ("Implement pid_to_exec_file for Windows
in gdbserver"). That change moves code from gdb/windows-nat.c to
gdb/nat/windows-nat.c, but doesn't add the required typedefs and
includes for parts of that code under ifdef __CYGWIN__.
---
 gdb/nat/windows-nat.c | 9 ++++++++-
 gdb/windows-nat.c     | 3 ---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c
index 71a18a0efa9..f6818015c53 100644
--- a/gdb/nat/windows-nat.c
+++ b/gdb/nat/windows-nat.c
@@ -21,8 +21,15 @@
 #include "gdbsupport/common-debug.h"
 #include "target/target.h"
 
-#ifdef __CYGWIN__
+#undef GetModuleFileNameEx
+
+#ifndef __CYGWIN__
+#define GetModuleFileNameEx GetModuleFileNameExA
+#else
+#include <sys/cygwin.h>
 #define __USEWIDE
+typedef wchar_t cygwin_buf_t;
+#define GetModuleFileNameEx GetModuleFileNameExW
 #endif
 
 namespace windows_nat
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 11f54302b11..6c6dea84bfa 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -79,11 +79,9 @@ static windows_process_info windows_process;
 
 #undef STARTUPINFO
 #undef CreateProcess
-#undef GetModuleFileNameEx
 
 #ifndef __CYGWIN__
 # define __PMAX	(MAX_PATH + 1)
-# define GetModuleFileNameEx GetModuleFileNameExA
 # define STARTUPINFO STARTUPINFOA
 # define CreateProcess CreateProcessA
 #else
@@ -93,7 +91,6 @@ static windows_process_info windows_process;
   static CORE_ADDR cygwin_load_end;
 #   define __USEWIDE
     typedef wchar_t cygwin_buf_t;
-#   define GetModuleFileNameEx GetModuleFileNameExW
 #   define STARTUPINFO STARTUPINFOW
 #   define CreateProcess CreateProcessW
 #endif
-- 
2.36.1


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

* [PATCH 2/4] Fix Cygwin build after 0578e87f
  2022-05-21 11:10 [PATCH 0/4] Various Cygwin build fixes Jon Turney
  2022-05-21 11:10 ` [PATCH 1/4] Fix Cygwin build after fcab5839 Jon Turney
@ 2022-05-21 11:10 ` Jon Turney
  2022-05-21 11:10 ` [PATCH 3/4] Fix Cygwin build after 85b25bd9 Jon Turney
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jon Turney @ 2022-05-21 11:10 UTC (permalink / raw)
  To: gdb-patches; +Cc: Jon Turney

Fix Cygwin build after 0578e87f ("Remove some globals from
nat/windows-nat.c").  Update code under ifdef __CYGWIN__ for globals
moved to members of struct windows_process_info.
---
 gdb/nat/windows-nat.c | 2 +-
 gdb/windows-nat.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c
index f6818015c53..ca6a529601e 100644
--- a/gdb/nat/windows-nat.c
+++ b/gdb/nat/windows-nat.c
@@ -198,7 +198,7 @@ windows_process_info::get_exec_module_filename (char *exe_name_ret,
        to POSIX format into the destination buffer.  */
     cygwin_buf_t *pathbuf = (cygwin_buf_t *) alloca (exe_name_max_len * sizeof (cygwin_buf_t));
 
-    len = GetModuleFileNameEx (current_process_handle,
+    len = GetModuleFileNameEx (handle,
 			       dh_buf, pathbuf, exe_name_max_len);
     if (len == 0)
       error (_("Error getting executable filename: %u."),
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 6c6dea84bfa..ab0efe72d8f 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -884,7 +884,7 @@ windows_nat::windows_process_info::handle_output_debug_string
 	  if (!retval)
 	    retval = current_event.dwThreadId;
 	  else if ((x = (LPCVOID) (uintptr_t) strtoull (p, NULL, 0))
-		   && ReadProcessMemory (current_process_handle, x,
+		   && ReadProcessMemory (handle, x,
 					 &saved_context,
 					 __COPY_CONTEXT_SIZE, &n)
 		   && n == __COPY_CONTEXT_SIZE)
-- 
2.36.1


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

* [PATCH 3/4] Fix Cygwin build after 85b25bd9
  2022-05-21 11:10 [PATCH 0/4] Various Cygwin build fixes Jon Turney
  2022-05-21 11:10 ` [PATCH 1/4] Fix Cygwin build after fcab5839 Jon Turney
  2022-05-21 11:10 ` [PATCH 2/4] Fix Cygwin build after 0578e87f Jon Turney
@ 2022-05-21 11:10 ` Jon Turney
  2022-05-21 11:10 ` [PATCH 4/4] Fix a new warning on Cygwin Jon Turney
  2022-05-26 16:55 ` [PATCH 0/4] Various Cygwin build fixes Tom Tromey
  4 siblings, 0 replies; 6+ messages in thread
From: Jon Turney @ 2022-05-21 11:10 UTC (permalink / raw)
  To: gdb-patches; +Cc: Jon Turney

Fix Cygwin build after 85b25bd9 ("Simplify windows-nat.c solib handling").
---
 gdb/windows-nat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index ab0efe72d8f..b98848bbc70 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -654,8 +654,8 @@ static std::vector<windows_solib> solibs;
 static windows_solib *
 windows_make_so (const char *name, LPVOID load_addr)
 {
-  char *p;
 #ifndef __CYGWIN__
+  char *p;
   char buf[__PMAX];
   char cwd[__PMAX];
   WIN32_FIND_DATA w32_fd;
@@ -738,7 +738,7 @@ windows_make_so (const char *name, LPVOID load_addr)
     {
       asection *text = NULL;
 
-      gdb_bfd_ref_ptr abfd (gdb_bfd_open (so->name, "pei-i386"));
+      gdb_bfd_ref_ptr abfd (gdb_bfd_open (so->name.c_str(), "pei-i386"));
 
       if (abfd == NULL)
 	return so;
-- 
2.36.1


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

* [PATCH 4/4] Fix a new warning on Cygwin
  2022-05-21 11:10 [PATCH 0/4] Various Cygwin build fixes Jon Turney
                   ` (2 preceding siblings ...)
  2022-05-21 11:10 ` [PATCH 3/4] Fix Cygwin build after 85b25bd9 Jon Turney
@ 2022-05-21 11:10 ` Jon Turney
  2022-05-26 16:55 ` [PATCH 0/4] Various Cygwin build fixes Tom Tromey
  4 siblings, 0 replies; 6+ messages in thread
From: Jon Turney @ 2022-05-21 11:10 UTC (permalink / raw)
  To: gdb-patches; +Cc: Jon Turney

> ../../gdb/windows-nat.c: In function ‘windows_solib* windows_make_so(const char*, LPVOID)’:
> ../../gdb/windows-nat.c:714:12: error: declaration of ‘char name [512]’ shadows a parameter [-Werror=shadow=compatible-local]
>   714 |       char name[SO_NAME_MAX_PATH_SIZE];
>       |            ^~~~
> ../../gdb/windows-nat.c:655:30: note: shadowed declaration is here
>   655 | windows_make_so (const char *name, LPVOID load_addr)
>       |                  ~~~~~~~~~~~~^~~~
---
 gdb/windows-nat.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index b98848bbc70..8631a1b4569 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -711,10 +711,10 @@ windows_make_so (const char *name, LPVOID load_addr)
 #else
   if (buf[0])
     {
-      char name[SO_NAME_MAX_PATH_SIZE];
-      cygwin_conv_path (CCP_WIN_W_TO_POSIX, buf, name,
+      char cname[SO_NAME_MAX_PATH_SIZE];
+      cygwin_conv_path (CCP_WIN_W_TO_POSIX, buf, cname,
 			SO_NAME_MAX_PATH_SIZE);
-      so->name = name;
+      so->name = cname;
     }
   else
     {
-- 
2.36.1


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

* Re: [PATCH 0/4] Various Cygwin build fixes
  2022-05-21 11:10 [PATCH 0/4] Various Cygwin build fixes Jon Turney
                   ` (3 preceding siblings ...)
  2022-05-21 11:10 ` [PATCH 4/4] Fix a new warning on Cygwin Jon Turney
@ 2022-05-26 16:55 ` Tom Tromey
  4 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2022-05-26 16:55 UTC (permalink / raw)
  To: Jon Turney; +Cc: gdb-patches

>>>>> "Jon" == Jon Turney <jon.turney@dronecode.org.uk> writes:

Jon> Jon Turney (4):
Jon>   Fix Cygwin build after fcab5839
Jon>   Fix Cygwin build after 0578e87f
Jon>   Fix Cygwin build after 85b25bd9
Jon>   Fix a new warning on Cygwin

Thank you.  These are ok.

Tom

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

end of thread, other threads:[~2022-05-26 16:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-21 11:10 [PATCH 0/4] Various Cygwin build fixes Jon Turney
2022-05-21 11:10 ` [PATCH 1/4] Fix Cygwin build after fcab5839 Jon Turney
2022-05-21 11:10 ` [PATCH 2/4] Fix Cygwin build after 0578e87f Jon Turney
2022-05-21 11:10 ` [PATCH 3/4] Fix Cygwin build after 85b25bd9 Jon Turney
2022-05-21 11:10 ` [PATCH 4/4] Fix a new warning on Cygwin Jon Turney
2022-05-26 16:55 ` [PATCH 0/4] Various Cygwin build fixes Tom Tromey

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).