aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
diff options
context:
space:
mode:
authorjimingham <jingham@apple.com>2023-11-30 09:48:04 -0800
committerGitHub <noreply@github.com>2023-11-30 09:48:04 -0800
commitd1bf1947e4e4f3ef75f2ba3ac9aa77dc38214de1 (patch)
treed443633500da7e90d4fb137e76aca8312a1a8ad4 /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
parentcb13e9286b6d4e384b5d4203e853d44e2eff0f0f (diff)
downloadllvm-d1bf1947e4e4f3ef75f2ba3ac9aa77dc38214de1.zip
llvm-d1bf1947e4e4f3ef75f2ba3ac9aa77dc38214de1.tar.gz
llvm-d1bf1947e4e4f3ef75f2ba3ac9aa77dc38214de1.tar.bz2
Send an explicit interrupt to cancel an attach waitfor. (#72565)
Currently when you interrupt a: (lldb) process attach -w -n some_process lldb just closes the connection to the stub and kills the lldb_private::Process it made for the attach. The stub at the other end notices the connection go down and exits because of that. But when communication to a device is handled through some kind of proxy server which isn't as well behaved as one would wish, that signal might not be reliable, causing debugserver to persist on the machine, waiting to steal the next instance of that process. We can work around those failures by sending an explicit interrupt before closing down the connection. The stub will also have to be waiting for the interrupt for this to make any difference. I changed debugserver to do that. I didn't make the equivalent change in lldb-server. So long as you aren't faced with a flakey connection, this should not be necessary.
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index e653ef5..9648f1f 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -2371,8 +2371,10 @@ Status ProcessGDBRemote::DoHalt(bool &caused_stop) {
Status error;
if (m_public_state.GetValue() == eStateAttaching) {
- // We are being asked to halt during an attach. We need to just close our
- // file handle and debugserver will go away, and we can be done...
+ // We are being asked to halt during an attach. We used to just close our
+ // file handle and debugserver will go away, but with remote proxies, it
+ // is better to send a positive signal, so let's send the interrupt first...
+ caused_stop = m_gdb_comm.Interrupt(GetInterruptTimeout());
m_gdb_comm.Disconnect();
} else
caused_stop = m_gdb_comm.Interrupt(GetInterruptTimeout());