[Lldb-commits] [lldb] [lldb-dap] Emit more structured info along with variables (PR #75244)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Thu Dec 14 11:58:59 PST 2023
================
@@ -1133,63 +1175,64 @@ llvm::json::Value CreateVariable(lldb::SBValue v, int64_t variablesReference,
int64_t varID, bool format_hex,
bool is_name_duplicated,
std::optional<std::string> custom_name) {
+ VariableDescription desc(v, format_hex, is_name_duplicated, custom_name);
llvm::json::Object object;
- EmplaceSafeString(
- object, "name",
- custom_name ? *custom_name
- : CreateUniqueVariableNameForDisplay(v, is_name_duplicated));
+ EmplaceSafeString(object, "name", desc.name);
+ EmplaceSafeString(object, "value", desc.display_value);
+
+ llvm::json::Object extensions;
+ if (desc.error)
+ EmplaceSafeString(extensions, "error", *desc.error);
+ if (!desc.lldb_value.empty())
+ EmplaceSafeString(extensions, "lldbValue", desc.lldb_value);
+ if (!desc.summary.empty())
+ EmplaceSafeString(extensions, "summary", desc.summary);
+ if (desc.auto_summary)
+ EmplaceSafeString(extensions, "autoSummary", *desc.auto_summary);
+ if (!desc.evaluate_name.empty())
+ EmplaceSafeString(object, "evaluateName", desc.evaluate_name);
----------------
clayborg wrote:
Maybe add a method to the `VariableDescription` class like `VariableDescription::AddExtensions(...)`. There are a lot of accesses to the internals of `VariableDescription`
https://github.com/llvm/llvm-project/pull/75244
More information about the lldb-commits
mailing list