[PATCH 8/8] [gdb/dap] Fix race between dap exit and gdb exit

Tom Tromey tom@tromey.com
Tue Feb 20 15:51:57 GMT 2024


>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> +@in_gdb_thread
Tom> +def _on_gdb_exiting(event):
Tom> +    dap_thread_join()

I think it's better not to export dap_thread_join and then import it
here, but instead just add to the event listener exactly where it's
needed.

Tom> +    global _dap_thread_for_gdb_thread
Tom> +    _dap_thread_for_gdb_thread = start_thread("DAP", really_start_dap)
 
You don't even need a new global if you add the listener here.

Tom> +def dap_thread_join():
Tom> +    global _dap_thread_for_gdb_thread
Tom> +    if _dap_thread_for_gdb_thread != None:

None of this will be necessary with the above, but FYI in Python it's
idiomatic to do this comparison with "if blah is not None"

Tom


More information about the Gdb-patches mailing list