From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 7A4CA386F0F7; Sun, 12 Jun 2022 21:56:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7A4CA386F0F7 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Fix self-test failure in addrmap X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 32681b482a3a38e240100ddd00280a3db5716874 X-Git-Newrev: aa09537375eb92448b2ba4ac5af5abac06c54cfc Message-Id: <20220612215616.7A4CA386F0F7@sourceware.org> Date: Sun, 12 Jun 2022 21:56:16 +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: Sun, 12 Jun 2022 21:56:16 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Daa09537375eb= 92448b2ba4ac5af5abac06c54cfc commit aa09537375eb92448b2ba4ac5af5abac06c54cfc Author: Tom Tromey Date: Sun Jun 12 15:53:40 2022 -0600 Fix self-test failure in addrmap =20 Mark pointed out that my recent addrmap C++-ficiation changes caused a regression in the self-tests. This patch fixes the problem by updating this test not to allocate the mutable addrmap on an obstack. Diff: --- gdb/addrmap.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/gdb/addrmap.c b/gdb/addrmap.c index 06f3a831df9..8c357fbf7e5 100644 --- a/gdb/addrmap.c +++ b/gdb/addrmap.c @@ -429,9 +429,8 @@ test_addrmap () void *val2 =3D &array[2]; =20 /* Create mutable addrmap. */ - struct obstack temp_obstack; - obstack_init (&temp_obstack); - struct addrmap_mutable *map =3D new (&temp_obstack) addrmap_mutable; + auto_obstack temp_obstack; + std::unique_ptr map (new addrmap_mutable); SELF_CHECK (map !=3D nullptr); =20 /* Check initial state. */ @@ -445,7 +444,7 @@ test_addrmap () =20 /* Create corresponding fixed addrmap. */ struct addrmap *map2 - =3D new (&temp_obstack) addrmap_fixed (&temp_obstack, map); + =3D new (&temp_obstack) addrmap_fixed (&temp_obstack, map.get ()); SELF_CHECK (map2 !=3D nullptr); CHECK_ADDRMAP_FIND (map2, array, 0, 9, nullptr); CHECK_ADDRMAP_FIND (map2, array, 10, 12, val1); @@ -479,9 +478,6 @@ test_addrmap () CHECK_ADDRMAP_FIND (map, array, 10, 12, val1); CHECK_ADDRMAP_FIND (map, array, 13, 13, val2); CHECK_ADDRMAP_FIND (map, array, 14, 19, nullptr); - - /* Cleanup. */ - obstack_free (&temp_obstack, NULL); } =20 } // namespace selftests