From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7872) id EA849385828F; Tue, 26 Jul 2022 12:35:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EA849385828F Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Enze Li To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/hurd: pass memory_tagged as false to find_memory_region_ftype X-Act-Checkin: binutils-gdb X-Git-Author: Enze Li X-Git-Refname: refs/heads/master X-Git-Oldrev: de69cec0c53f1ef5cb242bfc969723b7dba4defb X-Git-Newrev: e01493b7cb86ef874afb42efb1720ab1fbedfb6f Message-Id: <20220726123506.EA849385828F@sourceware.org> Date: Tue, 26 Jul 2022 12:35:06 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jul 2022 12:35:07 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3De01493b7cb86= ef874afb42efb1720ab1fbedfb6f commit e01493b7cb86ef874afb42efb1720ab1fbedfb6f Author: Enze Li Date: Sun Jul 24 11:20:46 2022 +0800 gdb/hurd: pass memory_tagged as false to find_memory_region_ftype =20 I tried building GDB on GNU/Hurd, and ran into this error: =20 CXX gnu-nat.o gnu-nat.c: In member function =E2=80=98virtual int gnu_nat_target::find= _memory_regions(find_memory_region_ftype, void*)=E2=80=99: 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 =20 This is because in this commit: =20 commit 68cffbbd4406b4efe1aa6e18460b1d7ca02549f1 Date: Thu Mar 31 11:42:35 2022 +0100 =20 [AArch64] MTE corefile support =20 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. =20 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. =20 Tested by rebuilding on GNU/Hurd, FreeBSD/amd64 and NetBSD/amd64. Diff: --- gdb/fbsd-nat.c | 2 +- gdb/gnu-nat.c | 2 ++ gdb/netbsd-nat.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c index 398f1c18b33..a4ca4a53415 100644 --- a/gdb/fbsd-nat.c +++ b/gdb/fbsd-nat.c @@ -125,7 +125,7 @@ fbsd_nat_target::find_memory_regions (find_memory_regio= n_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; } diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index 72314824278..5dd4d148c76 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -2623,6 +2623,7 @@ gnu_nat_target::find_memory_regions (find_memory_regi= on_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 =3D region_address; last_region_end =3D region_address +=3D region_length; @@ -2637,6 +2638,7 @@ gnu_nat_target::find_memory_regions (find_memory_regi= on_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); =20 return 0; diff --git a/gdb/netbsd-nat.c b/gdb/netbsd-nat.c index 8a4a43270d6..bbadd865823 100644 --- a/gdb/netbsd-nat.c +++ b/gdb/netbsd-nat.c @@ -260,7 +260,7 @@ nbsd_nat_target::find_memory_regions (find_memory_regio= n_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; }