51 lines · cpp
1//===-- ContinueRequestHandler.cpp ----------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include "DAP.h"10#include "Handler/RequestHandler.h"11#include "LLDBUtils.h"12#include "Protocol/ProtocolRequests.h"13#include "lldb/API/SBError.h"14#include "lldb/API/SBProcess.h"15#include "llvm/Support/Error.h"16 17using namespace llvm;18using namespace lldb;19using namespace lldb_dap::protocol;20 21namespace lldb_dap {22 23/// The request resumes execution of all threads. If the debug adapter supports24/// single thread execution (see capability25/// `supportsSingleThreadExecutionRequests`), setting the `singleThread`26/// argument to true resumes only the specified thread. If not all threads were27/// resumed, the `allThreadsContinued` attribute of the response should be set28/// to false.29Expected<ContinueResponseBody>30ContinueRequestHandler::Run(const ContinueArguments &args) const {31 SBProcess process = dap.target.GetProcess();32 SBError error;33 34 if (!SBDebugger::StateIsStoppedState(process.GetState()))35 return make_error<NotStoppedError>();36 37 if (args.singleThread)38 dap.GetLLDBThread(args.threadId).Resume(error);39 else40 error = process.Continue();41 42 if (error.Fail())43 return ToError(error);44 45 ContinueResponseBody body;46 body.allThreadsContinued = !args.singleThread;47 return body;48}49 50} // namespace lldb_dap51