Skip to content

Commit dfcdb0d

Browse files
committed
Fix merge and return an error if attachCommands fails to make a valid target.
1 parent 3d19e83 commit dfcdb0d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ Error AttachRequestHandler::Run(const AttachRequestArguments &args) const {
8080
// Disable async events so the attach will be successful when we return from
8181
// the launch call and the launch will happen synchronously
8282
ScopeSyncMode scope_sync_mode(dap.debugger);
83-
84-
dap.debugger.SetAsync(false);
83+
8584
if (args.coreFile.empty()) {
8685
if (args.gdbRemotePort != LLDB_DAP_INVALID_PORT) {
8786
lldb::SBListener listener = dap.debugger.GetListener();
@@ -112,6 +111,9 @@ Error AttachRequestHandler::Run(const AttachRequestArguments &args) const {
112111
// The custom commands might have created a new target so we should use the
113112
// selected target after these commands are run.
114113
dap.target = dap.debugger.GetSelectedTarget();
114+
if (!dap.target.IsValid())
115+
return make_error<DAPError>(
116+
"attachCommands failed to create a valid target");
115117

116118
// Make sure the process is attached and stopped before proceeding as the
117119
// the launch commands are not run using the synchronous mode.

0 commit comments

Comments
 (0)