forked from Imagelibrary/binutils-gdb
Fix gdb.interrupt race
gdb.interrupt was introduced to implement DAP request cancellation. However, because it can be run from another thread, and because I didn't look deeply enough at the implementation, it turns out to be racy. The fix here is to lock accesses to certain globals in extension.c. Note that this won't work in the case where configure detects that the C++ compiler doesn't provide thread support. This version of the patch disables DAP entirely in this situation. Regression tested on x86-64 Fedora 38. I also ran gdb.dap/pause.exp in a thread-sanitizer build tree to make sure the reported race is gone. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31263
This commit is contained in:
@@ -92,10 +92,14 @@ call_dap_fn (const char *fn_name)
|
||||
void
|
||||
dap_interp::init (bool top_level)
|
||||
{
|
||||
#if CXX_STD_THREAD
|
||||
call_dap_fn ("run");
|
||||
|
||||
current_ui->input_fd = -1;
|
||||
current_ui->m_input_interactive_p = false;
|
||||
#else
|
||||
error (_("GDB was compiled without threading, which DAP requires"));
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user