]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Avoid race when writing to index cache
authorTom Tromey <tom@tromey.com>
Sun, 28 Jan 2024 16:14:04 +0000 (09:14 -0700)
committerTom Tromey <tom@tromey.com>
Sat, 9 Mar 2024 00:25:50 +0000 (17:25 -0700)
commited29a346be439466ff2a5ce33e715e02c49fbdac
tree05fd227f4e975aca54a71f9b442f401dcb03ae31
parentba9583c7d598df78c45b86073cdbf1a9d7c40377
Avoid race when writing to index cache

The background DWARF reader changes introduced a race when writing to
the index cache.  The problem here is that constructing the
index_cache_store_context object should only happen on the main
thread, to ensure that the various value captures do not race.

This patch adds an assert to the construct to that effect, and then
arranges for this object to be constructed by the cooked_index_worker
constructor -- which is only invoked on the main thread.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31262
gdb/dwarf2/cooked-index.c
gdb/dwarf2/cooked-index.h
gdb/dwarf2/index-cache.c