From: Walter Erquinigo Date: Mon, 25 Jan 2021 22:05:04 +0000 (-0800) Subject: Fix 0f0462cacf34aa88ae71a13c4199c1b1e70f3ee6 X-Git-Tag: llvmorg-13-init~161 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1ac36b34db81d2fccd2b4a98d497be62083de3b1;p=platform%2Fupstream%2Fllvm.git Fix 0f0462cacf34aa88ae71a13c4199c1b1e70f3ee6 This fails on Windows because std::future fail to compile. Now switching to SBError as a workaround. Failed buildbot: http://lab.llvm.org:8011/#/builders/83/builds/3021 --- diff --git a/lldb/tools/lldb-vscode/RunInTerminal.cpp b/lldb/tools/lldb-vscode/RunInTerminal.cpp index 0df54bab..4db2806 100644 --- a/lldb/tools/lldb-vscode/RunInTerminal.cpp +++ b/lldb/tools/lldb-vscode/RunInTerminal.cpp @@ -128,9 +128,15 @@ RunInTerminalDebugAdapterCommChannel::RunInTerminalDebugAdapterCommChannel( StringRef comm_file) : m_io(comm_file, "runInTerminal launcher") {} -std::future RunInTerminalDebugAdapterCommChannel::NotifyDidAttach() { +// Can't use \a std::future because it doesn't compile on Windows +std::future +RunInTerminalDebugAdapterCommChannel::NotifyDidAttach() { return std::async(std::launch::async, [&]() { - return m_io.SendJSON(RunInTerminalMessageDidAttach().ToJSON()); + lldb::SBError error; + if (llvm::Error err = + m_io.SendJSON(RunInTerminalMessageDidAttach().ToJSON())) + error.SetErrorString(llvm::toString(std::move(err)).c_str()); + return error; }); } diff --git a/lldb/tools/lldb-vscode/RunInTerminal.h b/lldb/tools/lldb-vscode/RunInTerminal.h index 41f045d..cdccdd6 100644 --- a/lldb/tools/lldb-vscode/RunInTerminal.h +++ b/lldb/tools/lldb-vscode/RunInTerminal.h @@ -103,7 +103,7 @@ public: /// \return /// A future indicated whether the runInTerminal launcher received the /// message correctly or not. - std::future NotifyDidAttach(); + std::future NotifyDidAttach(); /// Fetch the pid of the runInTerminal launcher. /// diff --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp b/lldb/tools/lldb-vscode/lldb-vscode.cpp index 07b63f2..c581b9b 100644 --- a/lldb/tools/lldb-vscode/lldb-vscode.cpp +++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp @@ -1490,7 +1490,7 @@ llvm::Error request_runInTerminal(const llvm::json::Object &launch_request) { // This will notify the runInTerminal launcher that we attached. // We have to make this async, as the function won't return until the launcher // resumes and reads the data. - std::future did_attach_message_success = + std::future did_attach_message_success = comm_channel.NotifyDidAttach(); // We just attached to the runInTerminal launcher, which was waiting to be @@ -1509,7 +1509,11 @@ llvm::Error request_runInTerminal(const llvm::json::Object &launch_request) { // the async didAttach notification should have an error message, so we // return it. Otherwise, everything was a success. did_attach_message_success.wait(); - return did_attach_message_success.get(); + error = did_attach_message_success.get(); + if (error.Success()) + return llvm::Error::success(); + return llvm::createStringError(llvm::inconvertibleErrorCode(), + error.GetCString()); } // "LaunchRequest": {