[Lldb-commits] [lldb] [lldb-dap] Emit more structured info along with variables (PR #75244)

Walter Erquinigo via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 14 12:05:12 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);
----------------
walter-erquinigo wrote:

sure!

https://github.com/llvm/llvm-project/pull/75244


More information about the lldb-commits mailing list