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

When DAP shuts down due to an EOF event, there's a race between:
- gdb's main thread handling a SIGHUP, and
- the DAP main thread exiting.

Fix this by waiting for DAP's main thread exit during the gdb_exiting event.

Tested on aarch64-linux.

Approved-By: Tom Tromey <tom@tromey.com>

PR dap/31380
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31380
2 files changed