aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectFrame.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2025-02-19 15:17:35 -0800
committerGitHub <noreply@github.com>2025-02-19 15:17:35 -0800
commitf62f13d5db212b4bebe6fc143fb9827703e88dfd (patch)
tree7033693c7a17e0c9231e4105af5349dde482c721 /lldb/source/Commands/CommandObjectFrame.cpp
parentb0e24d17f294ce421ebf7174d8c74cdae374d7e7 (diff)
downloadllvm-f62f13d5db212b4bebe6fc143fb9827703e88dfd.zip
llvm-f62f13d5db212b4bebe6fc143fb9827703e88dfd.tar.gz
llvm-f62f13d5db212b4bebe6fc143fb9827703e88dfd.tar.bz2
[lldb] Store the return SBValueList in the CommandReturnObject (#127566)
There are a lot of lldb commands whose result is really one or more ValueObjects that we then print with the ValueObjectPrinter. Now that we have the ability to access the SBCommandReturnObject through a callback (#125006), we can store the resultant ValueObjects in the return object, allowing an IDE to access the SBValues and do its own rich formatting. rdar://143965453
Diffstat (limited to 'lldb/source/Commands/CommandObjectFrame.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectFrame.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index a5709b3..7e42ef2 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -152,6 +152,7 @@ protected:
return;
}
+ result.GetValueObjectList().Append(valobj_sp);
DumpValueObjectOptions::DeclPrintingHelper helper =
[&valobj_sp](ConstString type, ConstString var,
const DumpValueObjectOptions &opts,
@@ -317,10 +318,10 @@ protected:
} else if (*m_options.relative_frame_offset > 0) {
// I don't want "up 20" where "20" takes you past the top of the stack
// to produce an error, but rather to just go to the top. OTOH, start
- // by seeing if the requested frame exists, in which case we can avoid
+ // by seeing if the requested frame exists, in which case we can avoid
// counting the stack here...
- const uint32_t frame_requested = frame_idx
- + *m_options.relative_frame_offset;
+ const uint32_t frame_requested =
+ frame_idx + *m_options.relative_frame_offset;
StackFrameSP frame_sp = thread->GetStackFrameAtIndex(frame_requested);
if (frame_sp)
frame_idx = frame_requested;
@@ -515,8 +516,8 @@ protected:
if (error.Fail() && (!variable_list || variable_list->GetSize() == 0)) {
result.AppendError(error.AsCString());
-
}
+
ValueObjectSP valobj_sp;
TypeSummaryImplSP summary_format_sp;
@@ -564,6 +565,8 @@ protected:
valobj_sp = frame->GetValueObjectForFrameVariable(
var_sp, m_varobj_options.use_dynamic);
if (valobj_sp) {
+ result.GetValueObjectList().Append(valobj_sp);
+
std::string scope_string;
if (m_option_variable.show_scope)
scope_string = GetScopeString(var_sp).str();
@@ -604,6 +607,8 @@ protected:
entry.ref(), m_varobj_options.use_dynamic, expr_path_options,
var_sp, error);
if (valobj_sp) {
+ result.GetValueObjectList().Append(valobj_sp);
+
std::string scope_string;
if (m_option_variable.show_scope)
scope_string = GetScopeString(var_sp).str();
@@ -653,6 +658,8 @@ protected:
valobj_sp = frame->GetValueObjectForFrameVariable(
var_sp, m_varobj_options.use_dynamic);
if (valobj_sp) {
+ result.GetValueObjectList().Append(valobj_sp);
+
// When dumping all variables, don't print any variables that are
// not in scope to avoid extra unneeded output
if (valobj_sp->IsInScope()) {
@@ -694,6 +701,7 @@ protected:
recognized_frame->GetRecognizedArguments();
if (recognized_arg_list) {
for (auto &rec_value_sp : recognized_arg_list->GetObjects()) {
+ result.GetValueObjectList().Append(rec_value_sp);
options.SetFormat(m_option_format.GetFormat());
options.SetVariableFormatDisplayLanguage(
rec_value_sp->GetPreferredDisplayLanguage());