Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions lldb/tools/lldb-dap/Handler/NextRequestHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "DAP.h"
#include "EventHelper.h"
#include "LLDBUtils.h"
#include "Protocol/ProtocolTypes.h"
#include "RequestHandler.h"
#include "llvm/Support/Error.h"
Expand All @@ -30,16 +31,21 @@ Error NextRequestHandler::Run(const NextArguments &args) const {
if (!thread.IsValid())
return make_error<DAPError>("invalid thread");

if (!SBDebugger::StateIsStoppedState(dap.target.GetProcess().GetState()))
return make_error<NotStoppedError>();

// Remember the thread ID that caused the resume so we can set the
// "threadCausedFocus" boolean value in the "stopped" events.
dap.focus_tid = thread.GetThreadID();
lldb::SBError error;
if (args.granularity == eSteppingGranularityInstruction) {
thread.StepInstruction(/*step_over=*/true);
thread.StepInstruction(/*step_over=*/true, error);
} else {
thread.StepOver(args.singleThread ? eOnlyThisThread : eOnlyDuringStepping);
thread.StepOver(args.singleThread ? eOnlyThisThread : eOnlyDuringStepping,
error);
}

return Error::success();
return ToError(error);
}

} // namespace lldb_dap
14 changes: 10 additions & 4 deletions lldb/tools/lldb-dap/Handler/StepInRequestHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "DAP.h"
#include "EventHelper.h"
#include "LLDBUtils.h"
#include "Protocol/ProtocolRequests.h"
#include "Protocol/ProtocolTypes.h"
#include "RequestHandler.h"
Expand Down Expand Up @@ -39,9 +40,13 @@ Error StepInRequestHandler::Run(const StepInArguments &args) const {
// "threadCausedFocus" boolean value in the "stopped" events.
dap.focus_tid = thread.GetThreadID();

if (!SBDebugger::StateIsStoppedState(dap.target.GetProcess().GetState()))
return make_error<NotStoppedError>();

lldb::SBError error;
if (args.granularity == eSteppingGranularityInstruction) {
thread.StepInstruction(/*step_over=*/false);
return Error::success();
thread.StepInstruction(/*step_over=*/false, error);
return ToError(error);
}

std::string step_in_target;
Expand All @@ -50,8 +55,9 @@ Error StepInRequestHandler::Run(const StepInArguments &args) const {
step_in_target = it->second;

RunMode run_mode = args.singleThread ? eOnlyThisThread : eOnlyDuringStepping;
thread.StepInto(step_in_target.c_str(), run_mode);
return Error::success();
thread.StepInto(step_in_target.c_str(), LLDB_INVALID_LINE_NUMBER, error,
run_mode);
return ToError(error);
}

} // namespace lldb_dap
10 changes: 8 additions & 2 deletions lldb/tools/lldb-dap/Handler/StepOutRequestHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "DAP.h"
#include "EventHelper.h"
#include "LLDBUtils.h"
#include "Protocol/ProtocolRequests.h"
#include "RequestHandler.h"
#include "llvm/Support/Error.h"
Expand All @@ -32,12 +33,17 @@ Error StepOutRequestHandler::Run(const StepOutArguments &arguments) const {
if (!thread.IsValid())
return make_error<DAPError>("invalid thread");

if (!lldb::SBDebugger::StateIsStoppedState(
dap.target.GetProcess().GetState()))
return make_error<NotStoppedError>();

// Remember the thread ID that caused the resume so we can set the
// "threadCausedFocus" boolean value in the "stopped" events.
dap.focus_tid = thread.GetThreadID();
thread.StepOut();
lldb::SBError error;
thread.StepOut(error);

return Error::success();
return ToError(error);
}

} // namespace lldb_dap
Loading