llvm-project/lldb/tools/lldb-dap/Handler/ContinueRequestHandler.cpp
John Harrison 087a5d2ec7
[lldb-dap] Adding additional asserts to unit tests. (#140107)
Adding an assert that the 'continue' request succeeds caused a number of
tests to fail. This showed a number of tests that were not specifying if
they should be stopped or not at key points in the test. This is likely
contributing to these tests being flaky since the debugger is not in the
expected state.

Additionally, I spent a little time trying to improve the readability of
the dap_server.py and lldbdap_testcase.py.
2025-05-16 08:47:01 -07:00

51 lines
1.6 KiB
C++

//===-- ContinueRequestHandler.cpp ----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "DAP.h"
#include "Handler/RequestHandler.h"
#include "LLDBUtils.h"
#include "Protocol/ProtocolRequests.h"
#include "lldb/API/SBError.h"
#include "lldb/API/SBProcess.h"
#include "llvm/Support/Error.h"
using namespace llvm;
using namespace lldb;
using namespace lldb_dap::protocol;
namespace lldb_dap {
/// The request resumes execution of all threads. If the debug adapter supports
/// single thread execution (see capability
/// `supportsSingleThreadExecutionRequests`), setting the `singleThread`
/// argument to true resumes only the specified thread. If not all threads were
/// resumed, the `allThreadsContinued` attribute of the response should be set
/// to false.
Expected<ContinueResponseBody>
ContinueRequestHandler::Run(const ContinueArguments &args) const {
SBProcess process = dap.target.GetProcess();
SBError error;
if (!SBDebugger::StateIsStoppedState(process.GetState()))
return make_error<NotStoppedError>();
if (args.singleThread)
dap.GetLLDBThread(args.threadId).Resume(error);
else
error = process.Continue();
if (error.Fail())
return ToError(error);
ContinueResponseBody body;
body.allThreadsContinued = !args.singleThread;
return body;
}
} // namespace lldb_dap