[Lldb-commits] [lldb] [lldb-dap] Forward any error from stepping. (PR #142652)
Ebuka Ezike via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 3 11:10:25 PDT 2025
https://github.com/da-viper created https://github.com/llvm/llvm-project/pull/142652
The current implementation hides any possible error from performing a step command.
>From 7e940dcb0cfde1bc9be73c7cf2a40ba7f08d12e5 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike <yerimyah1 at gmail.com>
Date: Mon, 2 Jun 2025 17:07:50 +0100
Subject: [PATCH] [lldb-dap] Forward any error from stepping.
---
lldb/tools/lldb-dap/Handler/NextRequestHandler.cpp | 9 ++++++---
lldb/tools/lldb-dap/Handler/StepInRequestHandler.cpp | 11 +++++++----
lldb/tools/lldb-dap/Handler/StepOutRequestHandler.cpp | 6 ++++--
3 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/lldb/tools/lldb-dap/Handler/NextRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/NextRequestHandler.cpp
index 3fa167686d2f9..02fd77470fa08 100644
--- a/lldb/tools/lldb-dap/Handler/NextRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/NextRequestHandler.cpp
@@ -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"
@@ -33,13 +34,15 @@ Error NextRequestHandler::Run(const NextArguments &args) const {
// 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
diff --git a/lldb/tools/lldb-dap/Handler/StepInRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/StepInRequestHandler.cpp
index 15f242a9e18ff..1a70be7d220c5 100644
--- a/lldb/tools/lldb-dap/Handler/StepInRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/StepInRequestHandler.cpp
@@ -8,6 +8,7 @@
#include "DAP.h"
#include "EventHelper.h"
+#include "LLDBUtils.h"
#include "Protocol/ProtocolRequests.h"
#include "Protocol/ProtocolTypes.h"
#include "RequestHandler.h"
@@ -39,9 +40,10 @@ Error StepInRequestHandler::Run(const StepInArguments &args) const {
// "threadCausedFocus" boolean value in the "stopped" events.
dap.focus_tid = thread.GetThreadID();
+ 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;
@@ -50,8 +52,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
diff --git a/lldb/tools/lldb-dap/Handler/StepOutRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/StepOutRequestHandler.cpp
index 6b98582262a68..e31b38cb68bfd 100644
--- a/lldb/tools/lldb-dap/Handler/StepOutRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/StepOutRequestHandler.cpp
@@ -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"
@@ -35,9 +36,10 @@ Error StepOutRequestHandler::Run(const StepOutArguments &arguments) const {
// 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
More information about the lldb-commits
mailing list