Building GDB 15.0.91 on MinGW: gcore.c

Eli Zaretskii eliz@gnu.org
Thu Jun 6 20:20:14 GMT 2024


> From: Joel Brobecker <brobecker@adacore.com>
> Date: Sat,  1 Jun 2024 08:59:07 -0700 (PDT)
> 
> Hello,
> 
> I have just finished creating the gdb-15.0.91 pre-release.
> It is available for download at the following location:
> 
>     https://sourceware.org/pub/gdb/snapshots/branch/gdb-15.0.91.tar.xz
> 
> A gzip'ed version is also available: gdb-15.0.91.tar.gz.
> 
> Please give it a test if you can and report any problems you might find.

I get a warning compiling gcore.c:

       CXX    gcore.o
     gcore.c: In function 'int objfile_find_memory_regions(target_ops*, find_memory_region_ftype, void*)':
     gcore.c:563:36: warning: 'temp_top' may be used uninitialized in this function [-Wmaybe-uninitialized]
       563 |     (*func) (temp_bottom, temp_top - temp_bottom,
	   |                           ~~~~~~~~~^~~~~~~~~~~~~
     gcore.c:563:13: warning: 'temp_bottom' may be used uninitialized in this function [-Wmaybe-uninitialized]
       563 |     (*func) (temp_bottom, temp_top - temp_bottom,
	   |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       564 |       1, /* Stack section will be readable.  */
	   |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       565 |       1, /* Stack section will be writable.  */
	   |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       566 |       0, /* Stack section will not be executable.  */
	   |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       567 |       1, /* Stack section will be modified.  */
	   |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       568 |       false, /* No memory tags in the object file.  */
	   |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       569 |       obfd);
	   |       ~~~~~


Suggested fix:

--- gdb/gcore.c~0	2024-05-26 18:55:53.000000000 +0300
+++ gdb/gcore.c	2024-06-06 22:43:14.518884300 +0300
@@ -528,7 +528,7 @@ objfile_find_memory_regions (struct targ
 			     find_memory_region_ftype func, void *obfd)
 {
   /* Use objfile data to create memory sections.  */
-  bfd_vma temp_bottom, temp_top;
+  bfd_vma temp_bottom = 0, temp_top = 0;
 
   /* Call callback function for each objfile section.  */
   for (objfile *objfile : current_program_space->objfiles ())

OK to install?


More information about the Gdb-patches mailing list