summaryrefslogtreecommitdiff
path: root/gdb/utils.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-03-29 14:36:10 -0600
committerTom Tromey <tom@tromey.com>2022-03-30 13:39:48 -0600
commit47ccd6b84bdf35688fb1516f06db68462bd24585 (patch)
treec2fba1dac46a3637842d73a943a7e858c0fb0290 /gdb/utils.c
parentcd1c3a45442e8ef68d062215d508c8104a8e008d (diff)
downloadbinutils-gdb-47ccd6b84bdf35688fb1516f06db68462bd24585.tar.gz
Only allow QUIT on the main thread
Pedro pointed out that gdb worker threads should not react to quits. While I don't think that the new DWARF reader can call QUIT from a worker thread (and I don't think the existing minsym threading code can either), it seems safest to address this before checking in the new code. This patch arranges for the QUIT macro to only work on the main thread.
Diffstat (limited to 'gdb/utils.c')
-rw-r--r--gdb/utils.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/utils.c b/gdb/utils.c
index 2df9b1d7dcf..9ca268ad07f 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -78,6 +78,7 @@
#include "bt-utils.h"
#include "gdbsupport/buildargv.h"
#include "pager.h"
+#include "run-on-main-thread.h"
void (*deprecated_error_begin_hook) (void);
@@ -681,6 +682,9 @@ quit (void)
void
maybe_quit (void)
{
+ if (!is_main_thread ())
+ return;
+
if (sync_quit_force_run)
quit ();