From: Simon Marchi Date: Mon, 17 Nov 2025 21:32:56 +0000 (-0500) Subject: gdb: revert std -> gdb unordered_map change in x86-nat.c X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=017b9771ac003d2138266a877b894cc1bfac0c71;p=thirdparty%2Fbinutils-gdb.git gdb: revert std -> gdb unordered_map change in x86-nat.c This particular change in commit 965deba1208 ("gdb: use gdb::unordered_{set,map} at a few places") causes some regressions, for instance when running gdb.base/catch-fork-kill.exp: (gdb) PASS: gdb.base/catch-fork-kill.exp: fork-kind=fork: exit-kind=exit: fork: continue to child fork continue^M Continuing.^M [Attaching after Thread 0x7ffff7e74740 (LWP 490949) fork to child process 490952]^M [New inferior 2 (process 490952)]^M [Thread debugging using libthread_db enabled]^M Using host libthread_db library "/usr/lib/../lib/libthread_db.so.1".^M =================================================================^M ^[[1m^[[31m==490919==ERROR: AddressSanitizer: heap-use-after-free on address 0x7c9bac051d88 at pc 0x55f46adc7583 bp 0x7ffc862a1e90 sp 0x7ffc862a1e80 Function x86_linux_nat_target::low_new_fork calls function x86_debug_reg_state twice in a row. The first one returns a reference to an x86_debug_reg_state object in the map. The second causes an insertion to be made, moving the first object, rendering the first reference invalid. Revert the change and add a comment indicating that the location of x86_debug_reg_state objects is important. Change-Id: I85789d7657bec658a01908117efa25611e660878 --- diff --git a/gdb/x86-nat.c b/gdb/x86-nat.c index 381364cdd70..43e7764f142 100644 --- a/gdb/x86-nat.c +++ b/gdb/x86-nat.c @@ -38,9 +38,13 @@ struct x86_dr_low_type x86_dr_low; /* Hash table storing per-process data. We don't bind this to a per-inferior registry because of targets like x86 GNU/Linux that need to keep track of processes that aren't bound to any inferior - (e.g., fork children, checkpoints). */ + (e.g., fork children, checkpoints). -static gdb::unordered_map x86_debug_process_state; /* See x86-nat.h. */