diff options
author | Tom Tromey <tom@tromey.com> | 2023-02-18 09:27:58 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2024-01-08 18:40:21 -0700 |
commit | da0e2ac4f7c34114da60178b4077cf6410618353 (patch) | |
tree | 30eac7ac1b5d3f2b2138ae8edf4d0faa829ab7ed /gdb/main.c | |
parent | a2eb3f887cba11c87b625dbbd058557025e57596 (diff) | |
download | fsf-binutils-gdb-da0e2ac4f7c34114da60178b4077cf6410618353.zip fsf-binutils-gdb-da0e2ac4f7c34114da60178b4077cf6410618353.tar.gz fsf-binutils-gdb-da0e2ac4f7c34114da60178b4077cf6410618353.tar.bz2 |
Add thread-safety to gdb's BFD wrappers
This changes gdb to ensure that gdb's BFD cache is guarded by a lock.
This avoids any races when multiple threads might open a BFD (and thus
use the BFD cache) at the same time.
Currently, this change is not needed because the the main thread waits
for some DWARF scanning to be completed before returning. The only
locking that's required is when opening DWO files, and there's a local
lock to this end in dwarf2/read.c.
However, in the coming patches, the DWARF reader will begin its work
earlier, in the background. This means there is the potential for the
DWARF reader and other code on the main thread to both attempt to open
BFDs at the same time.
Diffstat (limited to 'gdb/main.c')
-rw-r--r-- | gdb/main.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -699,8 +699,7 @@ captured_main_1 (struct captured_main_args *context) auto temp_uiout = std::make_unique<cli_ui_out> (gdb_stdout); current_uiout = temp_uiout.get (); - if (bfd_init () != BFD_INIT_MAGIC) - error (_("fatal error: libbfd ABI mismatch")); + gdb_bfd_init (); #ifdef __MINGW32__ /* On Windows, argv[0] is not necessarily set to absolute form when |