]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/hurd: pass memory_tagged as false to find_memory_region_ftype
authorEnze Li <enze.li@hotmail.com>
Sun, 24 Jul 2022 03:20:46 +0000 (11:20 +0800)
committerJohn Baldwin <jhb@FreeBSD.org>
Thu, 1 Sep 2022 22:49:00 +0000 (15:49 -0700)
I tried building GDB on GNU/Hurd, and ran into this error:

  CXX    gnu-nat.o
gnu-nat.c: In member function ‘virtual int gnu_nat_target::find_memory_regions(find_memory_region_ftype, void*)’:
gnu-nat.c:2620:21: error: too few arguments to function
 2620 |             (*func) (last_region_address,
      |             ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
 2621 |                      last_region_end - last_region_address,
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2622 |                      last_protection & VM_PROT_READ,
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2623 |                      last_protection & VM_PROT_WRITE,
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2624 |                      last_protection & VM_PROT_EXECUTE,
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2625 |                      1, /* MODIFIED is unknown, pass it as true.  */
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2626 |                      data);
      |                      ~~~~~
gnu-nat.c:2635:13: error: too few arguments to function
 2635 |     (*func) (last_region_address, last_region_end - last_region_address,
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2636 |              last_protection & VM_PROT_READ,
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2637 |              last_protection & VM_PROT_WRITE,
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2638 |              last_protection & VM_PROT_EXECUTE,
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2639 |              1, /* MODIFIED is unknown, pass it as true.  */
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2640 |              data);
      |              ~~~~~
make[2]: *** [Makefile:1926: gnu-nat.o] Error 1

This is because in this commit:

  commit 68cffbbd4406b4efe1aa6e18460b1d7ca02549f1
  Date:   Thu Mar 31 11:42:35 2022 +0100

      [AArch64] MTE corefile support

Added a new argument to find_memory_region_ftype, but did not pass it to
the function in gnu-nat.c.  Fix this by passing memory_tagged as false.

As Luis pointed out, similar bugs may also appear on FreeBSD and NetBSD,
and I have reproduced them on both systems.  This patch fixes them
incidentally.

Tested by rebuilding on GNU/Hurd, FreeBSD/amd64 and NetBSD/amd64.

gdb/fbsd-nat.c
gdb/gnu-nat.c
gdb/netbsd-nat.c

index ec7f47f5afb5980df7b3939f19a7daaf4bc602f5..1c4d8f2938d290f0e8bde068d085cd6fd05324c0 100644 (file)
@@ -125,7 +125,7 @@ fbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
         Pass MODIFIED as true, we do not know the real modification state.  */
       func (kve->kve_start, size, kve->kve_protection & KVME_PROT_READ,
            kve->kve_protection & KVME_PROT_WRITE,
-           kve->kve_protection & KVME_PROT_EXEC, 1, data);
+           kve->kve_protection & KVME_PROT_EXEC, 1, false, data);
     }
   return 0;
 }
index 02938af7f8061ed228de624f8666aed12e2e6044..fa02576921275c4b8b39cb5f1ec75dca1db12182 100644 (file)
@@ -2623,6 +2623,7 @@ gnu_nat_target::find_memory_regions (find_memory_region_ftype func,
                     last_protection & VM_PROT_WRITE,
                     last_protection & VM_PROT_EXECUTE,
                     1, /* MODIFIED is unknown, pass it as true.  */
+                    false, /* No memory tags in the object file.  */
                     data);
          last_region_address = region_address;
          last_region_end = region_address += region_length;
@@ -2637,6 +2638,7 @@ gnu_nat_target::find_memory_regions (find_memory_region_ftype func,
             last_protection & VM_PROT_WRITE,
             last_protection & VM_PROT_EXECUTE,
             1, /* MODIFIED is unknown, pass it as true.  */
+            false, /* No memory tags in the object file.  */
             data);
 
   return 0;
index 9e9014283cde0dc0a4c96f7d784737421d81120c..f62e76ff76006201b77b9775ce30473d89511e5a 100644 (file)
@@ -259,7 +259,7 @@ nbsd_nat_target::find_memory_regions (find_memory_region_ftype func,
         Pass MODIFIED as true, we do not know the real modification state.  */
       func (kve->kve_start, size, kve->kve_protection & KVME_PROT_READ,
            kve->kve_protection & KVME_PROT_WRITE,
-           kve->kve_protection & KVME_PROT_EXEC, 1, data);
+           kve->kve_protection & KVME_PROT_EXEC, 1, false, data);
     }
   return 0;
 }