aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectTarget.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/CommandObjectTarget.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/CommandObjectTarget.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index da50fe0..71ddc8d 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -803,7 +803,9 @@ public:
protected:
void DumpGlobalVariableList(const ExecutionContext &exe_ctx,
const SymbolContext &sc,
- const VariableList &variable_list, Stream &s) {
+ const VariableList &variable_list,
+ CommandReturnObject &result) {
+ Stream &s = result.GetOutputStream();
if (variable_list.Empty())
return;
if (sc.module_sp) {
@@ -824,15 +826,16 @@ protected:
ValueObjectSP valobj_sp(ValueObjectVariable::Create(
exe_ctx.GetBestExecutionContextScope(), var_sp));
- if (valobj_sp)
+ if (valobj_sp) {
+ result.GetValueObjectList().Append(valobj_sp);
DumpValueObject(s, var_sp, valobj_sp, var_sp->GetName().GetCString());
+ }
}
}
void DoExecute(Args &args, CommandReturnObject &result) override {
Target *target = m_exe_ctx.GetTargetPtr();
const size_t argc = args.GetArgumentCount();
- Stream &s = result.GetOutputStream();
if (argc > 0) {
for (const Args::ArgEntry &arg : args) {
@@ -874,7 +877,7 @@ protected:
m_exe_ctx.GetBestExecutionContextScope(), var_sp);
if (valobj_sp)
- DumpValueObject(s, var_sp, valobj_sp,
+ DumpValueObject(result.GetOutputStream(), var_sp, valobj_sp,
use_var_name ? var_sp->GetName().GetCString()
: arg.c_str());
}
@@ -903,7 +906,8 @@ protected:
if (comp_unit_varlist_sp) {
size_t count = comp_unit_varlist_sp->GetSize();
if (count > 0) {
- DumpGlobalVariableList(m_exe_ctx, sc, *comp_unit_varlist_sp, s);
+ DumpGlobalVariableList(m_exe_ctx, sc, *comp_unit_varlist_sp,
+ result);
success = true;
}
}
@@ -964,7 +968,8 @@ protected:
VariableListSP comp_unit_varlist_sp(
sc.comp_unit->GetVariableList(can_create));
if (comp_unit_varlist_sp)
- DumpGlobalVariableList(m_exe_ctx, sc, *comp_unit_varlist_sp, s);
+ DumpGlobalVariableList(m_exe_ctx, sc, *comp_unit_varlist_sp,
+ result);
} else if (sc.module_sp) {
// Get all global variables for this module
lldb_private::RegularExpression all_globals_regex(
@@ -972,7 +977,7 @@ protected:
VariableList variable_list;
sc.module_sp->FindGlobalVariables(all_globals_regex, UINT32_MAX,
variable_list);
- DumpGlobalVariableList(m_exe_ctx, sc, variable_list, s);
+ DumpGlobalVariableList(m_exe_ctx, sc, variable_list, result);
}
}
}