diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2020-07-14 08:44:40 -0700 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2020-07-14 08:45:34 -0700 |
commit | 706cccb889c8d14791c029a7bb69d8eddb6b1728 (patch) | |
tree | a1fa0e6f237d45fb0049f99c8c46cca905497f5d /lldb/source/Commands/CommandObjectProcess.cpp | |
parent | 50a5fa8b9ba4b09433bf46f4228d4e4cae9ac486 (diff) | |
download | llvm-706cccb889c8d14791c029a7bb69d8eddb6b1728.zip llvm-706cccb889c8d14791c029a7bb69d8eddb6b1728.tar.gz llvm-706cccb889c8d14791c029a7bb69d8eddb6b1728.tar.bz2 |
[lldb] Make `process connect` blocking in synchronous mode.
In synchronous mode, the process connect command and its aliases should
wait for the stop event before claiming the command is complete.
Currently, the stop event is always handled asynchronously by the
debugger.
The implementation takes the same approach as Process::ResumeSynchronous
which hijacks the event and handles it on the current thread. Similarly,
after this patch, the stop event is part of the command return object,
which is the property used by the test case.
Differential revision: https://reviews.llvm.org/D83728
Diffstat (limited to 'lldb/source/Commands/CommandObjectProcess.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectProcess.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index 3659f0d..f86779d8 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -820,9 +820,15 @@ protected: Status error; Debugger &debugger = GetDebugger(); PlatformSP platform_sp = m_interpreter.GetPlatform(true); - ProcessSP process_sp = platform_sp->ConnectProcess( - command.GetArgumentAtIndex(0), plugin_name, debugger, - debugger.GetSelectedTarget().get(), error); + ProcessSP process_sp = + debugger.GetAsyncExecution() + ? platform_sp->ConnectProcess( + command.GetArgumentAtIndex(0), plugin_name, debugger, + debugger.GetSelectedTarget().get(), error) + : platform_sp->ConnectProcessSynchronous( + command.GetArgumentAtIndex(0), plugin_name, debugger, + result.GetOutputStream(), debugger.GetSelectedTarget().get(), + error); if (error.Fail() || process_sp == nullptr) { result.AppendError(error.AsCString("Error connecting to the process")); result.SetStatus(eReturnStatusFailed); |