MinGW build of GDB 13 snapshot

Message ID 83k02qgdbo.fsf@gnu.org
State Committed
Headers
Series MinGW build of GDB 13 snapshot |

Commit Message

Eli Zaretskii Dec. 17, 2022, 5:16 p.m. UTC
  I've built the latest snapshot 13.0.50.20221217-git of GDB using
mingw.org's MinGW on MS-Windows.  I saw only two issues with this
build, described below.

One of those issues is in the bfd directory, and I will report it to
the Binutils list.  I'm asking here what to do with that issue
meanwhile: do I install a fix for it in our copy of bfd, or do I wait
for Binutils folks to fix it up-stream?  The fix is simple:
  

Comments

Tom Tromey Dec. 19, 2022, 9:14 p.m. UTC | #1
>>>>> "Eli" == Eli Zaretskii via Gdb-patches <gdb-patches@sourceware.org> writes:

Eli> One of those issues is in the bfd directory, and I will report it to
Eli> the Binutils list.  I'm asking here what to do with that issue
Eli> meanwhile: do I install a fix for it in our copy of bfd, or do I wait
Eli> for Binutils folks to fix it up-stream?  The fix is simple:

IMO it's fine to put on the gdb 13 branch.
I suppose if binutils wants changes we can consider putting their
approved version on the branch instead.

Eli> The other issue is with the new stuff in nat/windows-nat.c.  Here are
Eli> the compilation error messages:
...
Eli> This happens because these two symbols are not visible when compiling
Eli> GDB with _WIN32_WINNT set to an older version that Windows 8.  The
Eli> patch for this is below.  OK to commit it on the master branch?

This is ok.  Thank you. 

Tom
  
Eli Zaretskii Dec. 20, 2022, 2:12 p.m. UTC | #2
> From: Tom Tromey <tom@tromey.com>
> Cc: Eli Zaretskii <eliz@gnu.org>,  Joel Brobecker <brobecker@adacore.com>
> Date: Mon, 19 Dec 2022 14:14:35 -0700
> 
> >>>>> "Eli" == Eli Zaretskii via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Eli> One of those issues is in the bfd directory, and I will report it to
> Eli> the Binutils list.  I'm asking here what to do with that issue
> Eli> meanwhile: do I install a fix for it in our copy of bfd, or do I wait
> Eli> for Binutils folks to fix it up-stream?  The fix is simple:
> 
> IMO it's fine to put on the gdb 13 branch.
> I suppose if binutils wants changes we can consider putting their
> approved version on the branch instead.

The problem is now fixed in upstream Binutils, see

  https://sourceware.org/bugzilla/show_bug.cgi?id=29915

So I think I will fix this on the gdb 13 branch only, and master will
be fixed in due time when we import the latest BFD?  Or do you want me
to fix this on both branches?  Joel?

> Eli> The other issue is with the new stuff in nat/windows-nat.c.  Here are
> Eli> the compilation error messages:
> ...
> Eli> This happens because these two symbols are not visible when compiling
> Eli> GDB with _WIN32_WINNT set to an older version that Windows 8.  The
> Eli> patch for this is below.  OK to commit it on the master branch?
> 
> This is ok.  Thank you. 

Thanks, will install soon.
  
Joel Brobecker Dec. 21, 2022, 3:26 a.m. UTC | #3
Hi Eli,

On Tue, Dec 20, 2022 at 04:12:12PM +0200, Eli Zaretskii wrote:
> > From: Tom Tromey <tom@tromey.com>
> > Cc: Eli Zaretskii <eliz@gnu.org>,  Joel Brobecker <brobecker@adacore.com>
> > Date: Mon, 19 Dec 2022 14:14:35 -0700
> > 
> > >>>>> "Eli" == Eli Zaretskii via Gdb-patches <gdb-patches@sourceware.org> writes:
> > 
> > Eli> One of those issues is in the bfd directory, and I will report it to
> > Eli> the Binutils list.  I'm asking here what to do with that issue
> > Eli> meanwhile: do I install a fix for it in our copy of bfd, or do I wait
> > Eli> for Binutils folks to fix it up-stream?  The fix is simple:
> > 
> > IMO it's fine to put on the gdb 13 branch.
> > I suppose if binutils wants changes we can consider putting their
> > approved version on the branch instead.
> 
> The problem is now fixed in upstream Binutils, see
> 
>   https://sourceware.org/bugzilla/show_bug.cgi?id=29915
> 
> So I think I will fix this on the gdb 13 branch only, and master will
> be fixed in due time when we import the latest BFD?  Or do you want me
> to fix this on both branches?  Joel?

Binutils and GDB share the same repository, so it's the same master
branch. Alan's fix on master, if you confirm fixes the problem on
master, can be cherry-picked to the gdb-13-branch.

Otherwise, if Alan's fix does not work, we can indeed start with
your patch in gdb-13-branch, and wait for master to get fixed
via the binutils team.
  
Eli Zaretskii Dec. 22, 2022, 10:46 a.m. UTC | #4
> Date: Wed, 21 Dec 2022 07:26:49 +0400
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: Tom Tromey <tom@tromey.com>, brobecker@adacore.com,
> 	gdb-patches@sourceware.org
> 
> > The problem is now fixed in upstream Binutils, see
> > 
> >   https://sourceware.org/bugzilla/show_bug.cgi?id=29915
> > 
> > So I think I will fix this on the gdb 13 branch only, and master will
> > be fixed in due time when we import the latest BFD?  Or do you want me
> > to fix this on both branches?  Joel?
> 
> Binutils and GDB share the same repository, so it's the same master
> branch. Alan's fix on master, if you confirm fixes the problem on
> master, can be cherry-picked to the gdb-13-branch.
> 
> Otherwise, if Alan's fix does not work, we can indeed start with
> your patch in gdb-13-branch, and wait for master to get fixed
> via the binutils team.

OK, done.

I also installed the other patch, approved by Tom.

Thanks.
  
Joel Brobecker Dec. 23, 2022, 3:28 a.m. UTC | #5
Hi Eli,

On Thu, Dec 22, 2022 at 12:46:14PM +0200, Eli Zaretskii wrote:
> > Date: Wed, 21 Dec 2022 07:26:49 +0400
> > From: Joel Brobecker <brobecker@adacore.com>
> > Cc: Tom Tromey <tom@tromey.com>, brobecker@adacore.com,
> > 	gdb-patches@sourceware.org
> > 
> > > The problem is now fixed in upstream Binutils, see
> > > 
> > >   https://sourceware.org/bugzilla/show_bug.cgi?id=29915
> > > 
> > > So I think I will fix this on the gdb 13 branch only, and master will
> > > be fixed in due time when we import the latest BFD?  Or do you want me
> > > to fix this on both branches?  Joel?
> > 
> > Binutils and GDB share the same repository, so it's the same master
> > branch. Alan's fix on master, if you confirm fixes the problem on
> > master, can be cherry-picked to the gdb-13-branch.
> > 
> > Otherwise, if Alan's fix does not work, we can indeed start with
> > your patch in gdb-13-branch, and wait for master to get fixed
> > via the binutils team.
> 
> OK, done.
> 
> I also installed the other patch, approved by Tom.

Thank you.

Just for the avoidance of doubt: On the gdb-13-branch, I see
you cherry-picked Alan's change and then applied the fix for
the other issue you noticed.

What about master? Alan's change was pushed by Alan himself
a few days ago, but what about the fix for the other issue?
Did you push it there as well? I don't seem to be able to
see it.
  
Eli Zaretskii Dec. 23, 2022, 8:07 a.m. UTC | #6
> Date: Fri, 23 Dec 2022 07:28:54 +0400
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: Joel Brobecker <brobecker@adacore.com>, tom@tromey.com,
> 	gdb-patches@sourceware.org
> 
> What about master? Alan's change was pushed by Alan himself
> a few days ago, but what about the fix for the other issue?
> Did you push it there as well? I don't seem to be able to
> see it.

Sorry, I forgot about master when I installed the changes in
windows-nat.c.

Should I cherry-pick the change from gdb-13-branch to master?
  
Joel Brobecker Dec. 23, 2022, 9:13 a.m. UTC | #7
> > What about master? Alan's change was pushed by Alan himself
> > a few days ago, but what about the fix for the other issue?
> > Did you push it there as well? I don't seem to be able to
> > see it.
> 
> Sorry, I forgot about master when I installed the changes in
> windows-nat.c.
> 
> Should I cherry-pick the change from gdb-13-branch to master?

Sure! That should work.
  
Eli Zaretskii Dec. 23, 2022, 11:21 a.m. UTC | #8
> Date: Fri, 23 Dec 2022 13:13:45 +0400
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: Joel Brobecker <brobecker@adacore.com>, tom@tromey.com,
> 	gdb-patches@sourceware.org
> 
> > > What about master? Alan's change was pushed by Alan himself
> > > a few days ago, but what about the fix for the other issue?
> > > Did you push it there as well? I don't seem to be able to
> > > see it.
> > 
> > Sorry, I forgot about master when I installed the changes in
> > windows-nat.c.
> > 
> > Should I cherry-pick the change from gdb-13-branch to master?
> 
> Sure! That should work.

Thanks, done.
  

Patch

--- bfd/bfdio.c~0	2022-12-17 03:47:10.000000000 +0200
+++ bfd/bfdio.c	2022-12-17 16:45:38.067750000 +0200
@@ -31,8 +31,10 @@ 
 #include <locale.h>
 #endif
 
-#if defined(__MINGW64_VERSION_MAJOR) && __MINGW64_VERSION_MAJOR < 9
-/* This prototype was added to locale.h in version 9.0 of MinGW-w64.  */
+#if (defined(__MINGW64_VERSION_MAJOR) && __MINGW64_VERSION_MAJOR < 9)	\
+  || (defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR))
+/* This prototype was added to locale.h in version 9.0 of MinGW-w64,
+   and is absent from all versions of mingw.org's MinGW.  */
 _CRTIMP unsigned int __cdecl ___lc_codepage_func(void);
 #endif
 


The other issue is with the new stuff in nat/windows-nat.c.  Here are
the compilation error messages:

       CXX    nat/windows-nat.o
     ../gdb/nat/windows-nat.c: In function 'BOOL windows_nat::create_process_wrapper(FUNC*, const CHAR*, CHAR*, DWORD, void*, const CHAR*, bool, INFO*, PROCESS_INFORMATION*)':
     ../gdb/nat/windows-nat.c:813:9: error: 'PPROC_THREAD_ATTRIBUTE_LIST' was not declared in this scope
       813 |      = (PPROC_THREAD_ATTRIBUTE_LIST) alloca (size);
	   |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
     ../gdb/nat/windows-nat.c:813:37: error: expected ';' before '__builtin_alloca'
       813 |      = (PPROC_THREAD_ATTRIBUTE_LIST) alloca (size);
	   |                                     ^
	   |                                     ;
     ../gdb/nat/windows-nat.c:831:9: error: 'EXTENDED_STARTUPINFO_PRESENT' was not declared in this scope
       831 |       | EXTENDED_STARTUPINFO_PRESENT),
	   |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

This happens because these two symbols are not visible when compiling
GDB with _WIN32_WINNT set to an older version that Windows 8.  The
patch for this is below.  OK to commit it on the master branch?

--- gdb/nat/windows-nat.c~0	2022-12-17 03:47:12.000000000 +0200
+++ gdb/nat/windows-nat.c	2022-12-17 16:46:20.817750000 +0200
@@ -802,6 +802,10 @@  create_process_wrapper (FUNC *do_create_
 
 	  gdb_extended_info info_ex {};
 
+#	  ifndef EXTENDED_STARTUPINFO_PRESENT
+#	   define EXTENDED_STARTUPINFO_PRESENT 0x00080000
+#	  endif
+
 	  if (startup_info != nullptr)
 	    info_ex.StartupInfo = *startup_info;
 	  info_ex.StartupInfo.cb = sizeof (info_ex);
@@ -810,7 +814,7 @@  create_process_wrapper (FUNC *do_create_
 	     call always fails, by design.  */
 	  InitializeProcThreadAttributeList (nullptr, 1, 0, &size);
 	  info_ex.lpAttributeList
-	    = (PPROC_THREAD_ATTRIBUTE_LIST) alloca (size);
+	    = (gdb_lpproc_thread_attribute_list) alloca (size);
 	  InitializeProcThreadAttributeList (info_ex.lpAttributeList,
 					     1, 0, &size);