[Lldb-commits] [lldb] [lldb-dap] Add: show return value on step out (PR #106907)
via lldb-commits
lldb-commits at lists.llvm.org
Sun Sep 1 06:03:23 PDT 2024
https://github.com/Da-Viper created https://github.com/llvm/llvm-project/pull/106907
https://github.com/user-attachments/assets/cff48c6f-37ae-4f72-b881-3eff4178fb3c
>From 2ca64edb00d1f7b9d2938c9db32644c4a8cbc13e Mon Sep 17 00:00:00 2001
From: Ezike Ebuka <yerimyah1 at gmail.com>
Date: Sun, 1 Sep 2024 13:48:41 +0100
Subject: [PATCH] Add: show return value on step out
---
lldb/tools/lldb-dap/lldb-dap.cpp | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index c5c4b09f15622b..c9116c62c46b5e 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -3801,6 +3801,17 @@ void request_variables(const llvm::json::Object &request) {
variable_name_counts[GetNonNullVariableName(variable)]++;
}
+ // Show return value if there is any ( in the top frame )
+ auto process = g_dap.target.GetProcess();
+ auto selectedThread = process.GetSelectedThread();
+ lldb::SBValue stopReturnValue = selectedThread.GetStopReturnValue();
+ if (stopReturnValue.IsValid() &&
+ (selectedThread.GetSelectedFrame().GetFrameID() == 0)) {
+ auto renamedReturnValue = stopReturnValue.Clone("(Return Value)");
+ variables.emplace_back(
+ CreateVariable(renamedReturnValue,0, UINT64_MAX, hex, false));
+ }
+
// Now we construct the result with unique display variable names
for (auto i = start_idx; i < end_idx; ++i) {
lldb::SBValue variable = top_scope->GetValueAtIndex(i);
More information about the lldb-commits
mailing list