yinghuitan updated this revision to Diff 458809.
yinghuitan added a comment.

Address review feedback.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133038/new/

https://reviews.llvm.org/D133038

Files:
  lldb/bindings/interface/SBDebugger.i
  lldb/include/lldb/API/SBDebugger.h
  lldb/include/lldb/Core/UserSettingsController.h
  lldb/include/lldb/Interpreter/OptionValue.h
  lldb/include/lldb/Interpreter/OptionValueArray.h
  lldb/include/lldb/Interpreter/OptionValueBoolean.h
  lldb/include/lldb/Interpreter/OptionValueChar.h
  lldb/include/lldb/Interpreter/OptionValueDictionary.h
  lldb/include/lldb/Interpreter/OptionValueLanguage.h
  lldb/include/lldb/Interpreter/OptionValuePathMappings.h
  lldb/include/lldb/Interpreter/OptionValueProperties.h
  lldb/include/lldb/Interpreter/OptionValueRegex.h
  lldb/include/lldb/Interpreter/OptionValueSInt64.h
  lldb/include/lldb/Interpreter/OptionValueString.h
  lldb/include/lldb/Interpreter/OptionValueUInt64.h
  lldb/include/lldb/Interpreter/OptionValueUUID.h
  lldb/include/lldb/Target/PathMappingList.h
  lldb/source/API/SBDebugger.cpp
  lldb/source/Core/UserSettingsController.cpp
  lldb/source/Interpreter/OptionValueArray.cpp
  lldb/source/Interpreter/OptionValueDictionary.cpp
  lldb/source/Interpreter/OptionValueLanguage.cpp
  lldb/source/Interpreter/OptionValuePathMappings.cpp
  lldb/source/Interpreter/OptionValueProperties.cpp
  lldb/source/Target/PathMappingList.cpp
  lldb/test/API/commands/settings/TestSettings.py
  lldb/test/API/functionalities/source-map/TestTargetSourceMap.py

Index: lldb/test/API/functionalities/source-map/TestTargetSourceMap.py
===================================================================
--- lldb/test/API/functionalities/source-map/TestTargetSourceMap.py
+++ lldb/test/API/functionalities/source-map/TestTargetSourceMap.py
@@ -1,11 +1,45 @@
 import lldb
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test.decorators import *
+import json
 import os
 
 
 class TestTargetSourceMap(TestBase):
 
+    @no_debug_info_test
+    def test_source_map_via_setting_api(self):
+        """
+            Test that ensures SBDebugger::GetSetting("target.source-map") API
+            can correctly fetch source mapping entries.
+        """
+        # Set the target soure map to map "./" to the current test directory
+        src_dir = self.getSourceDir()
+
+        source_map_setting_path = "target.source-map"
+        initial_source_map = self.dbg.GetSetting(source_map_setting_path)
+        self.assertEquals(initial_source_map.GetSize(), 0,
+            "Initial source map should be empty")
+
+        src_dir = self.getSourceDir()
+        self.runCmd('settings set target.source-map . "%s"' % src_dir)
+
+        source_map = self.dbg.GetSetting(source_map_setting_path)
+        self.assertEquals(source_map.GetSize(), 1,
+            "source map should be have one appended entry")
+
+        stream = lldb.SBStream()
+        source_map.GetAsJSON(stream)
+        serialized_source_map = json.loads(stream.GetData())
+
+        self.assertEquals(len(serialized_source_map[0]), 2,
+            "source map entry should have two parts")
+        self.assertEquals(serialized_source_map[0][0], ".",
+            "source map entry's first part does not match")
+        self.assertEquals(serialized_source_map[0][1], src_dir,
+            "source map entry's second part does not match")
+
+
     @no_debug_info_test
     def test_source_map(self):
         """Test target.source-map' functionality."""
Index: lldb/test/API/commands/settings/TestSettings.py
===================================================================
--- lldb/test/API/commands/settings/TestSettings.py
+++ lldb/test/API/commands/settings/TestSettings.py
@@ -3,7 +3,7 @@
 """
 
 
-
+import json
 import os
 import re
 import lldb
@@ -274,7 +274,7 @@
         self.assertEqual(launch_info.GetArgumentAtIndex(0), "A")
         self.assertEqual(launch_info.GetArgumentAtIndex(1), "B")
         self.assertEqual(launch_info.GetArgumentAtIndex(2), "C")
-        
+
         self.expect(
             'target show-launch-environment',
             substrs=["MY_ENV_VAR=YES"])
@@ -787,3 +787,31 @@
 
         # A known option should fail if its argument is invalid.
         self.expect("settings set auto-confirm bogus", error=True)
+
+    def test_settings_api(self):
+        """
+            Test that ensures SBDebugger::GetSettings()/GetSetting() APIs
+            can correctly fetch settings.
+        """
+        self.runCmd("settings set auto-confirm true")
+        self.runCmd("settings set tab-size 2")
+        arg_value = "arg_value"
+        self.runCmd('settings set target.arg0 %s' % arg_value)
+
+        settings_data = self.dbg.GetSettings()
+        self.assertTrue(settings_data.GetSize() > 0)
+
+        stream = lldb.SBStream()
+        settings_data.GetAsJSON(stream)
+        settings_json = json.loads(stream.GetData())
+        self.assertTrue(len(settings_json) > 0)
+
+        self.assertEqual(settings_json["auto-confirm"], True)
+        self.assertEqual(settings_json["tab-size"], 2)
+        self.assertEqual(settings_json["target"]["arg0"], arg_value)
+
+
+        settings_data = self.dbg.GetSetting("target.arg0")
+        stream2 = lldb.SBStream()
+        settings_data.GetAsJSON(stream2)
+        self.assertEqual(json.loads(stream2.GetData()), arg_value)
Index: lldb/source/Target/PathMappingList.cpp
===================================================================
--- lldb/source/Target/PathMappingList.cpp
+++ lldb/source/Target/PathMappingList.cpp
@@ -131,6 +131,16 @@
   }
 }
 
+llvm::json::Value PathMappingList::ToJSON() {
+  llvm::json::Array entries;
+  for (const auto &pair : m_pairs) {
+    llvm::json::Array entry{pair.first.GetStringRef().str(),
+                            pair.second.GetStringRef().str()};
+    entries.emplace_back(std::move(entry));
+  }
+  return std::move(entries);
+}
+
 void PathMappingList::Clear(bool notify) {
   if (!m_pairs.empty())
     ++m_mod_id;
Index: lldb/source/Interpreter/OptionValueProperties.cpp
===================================================================
--- lldb/source/Interpreter/OptionValueProperties.cpp
+++ lldb/source/Interpreter/OptionValueProperties.cpp
@@ -545,10 +545,26 @@
   }
 }
 
+llvm::json::Value
+OptionValueProperties::ToJSON(const ExecutionContext *exe_ctx) {
+  llvm::json::Object json_properties;
+  const size_t num_properties = m_properties.size();
+  for (size_t i = 0; i < num_properties; ++i) {
+    const Property *property = GetPropertyAtIndex(exe_ctx, false, i);
+    if (property) {
+      OptionValue *option_value = property->GetValue().get();
+      assert(option_value);
+      json_properties.try_emplace(property->GetName(),
+                                  option_value->ToJSON(exe_ctx));
+    }
+  }
+  return std::move(json_properties);
+}
+
 Status OptionValueProperties::DumpPropertyValue(const ExecutionContext *exe_ctx,
                                                 Stream &strm,
                                                 llvm::StringRef property_path,
-                                                uint32_t dump_mask) {
+                                                uint32_t dump_mask, bool is_json) {
   Status error;
   const bool will_modify = false;
   lldb::OptionValueSP value_sp(
@@ -560,7 +576,10 @@
       if (dump_mask & ~eDumpOptionName)
         strm.PutChar(' ');
     }
-    value_sp->DumpValue(exe_ctx, strm, dump_mask);
+    if (is_json) {
+      strm.Printf("%s", llvm::formatv("{0:2}", value_sp->ToJSON(exe_ctx)).str().c_str());
+    } else
+      value_sp->DumpValue(exe_ctx, strm, dump_mask);
   }
   return error;
 }
Index: lldb/source/Interpreter/OptionValuePathMappings.cpp
===================================================================
--- lldb/source/Interpreter/OptionValuePathMappings.cpp
+++ lldb/source/Interpreter/OptionValuePathMappings.cpp
@@ -34,6 +34,11 @@
   }
 }
 
+llvm::json::Value
+OptionValuePathMappings::ToJSON(const ExecutionContext *exe_ctx) {
+  return m_path_mappings.ToJSON();
+}
+
 Status OptionValuePathMappings::SetValueFromString(llvm::StringRef value,
                                                    VarSetOperationType op) {
   Status error;
Index: lldb/source/Interpreter/OptionValueLanguage.cpp
===================================================================
--- lldb/source/Interpreter/OptionValueLanguage.cpp
+++ lldb/source/Interpreter/OptionValueLanguage.cpp
@@ -29,6 +29,10 @@
   }
 }
 
+llvm::json::Value OptionValueLanguage::ToJSON(const ExecutionContext *exe_ctx) {
+  return Language::GetNameForLanguageType(m_current_value);
+}
+
 Status OptionValueLanguage::SetValueFromString(llvm::StringRef value,
                                                VarSetOperationType op) {
   Status error;
Index: lldb/source/Interpreter/OptionValueDictionary.cpp
===================================================================
--- lldb/source/Interpreter/OptionValueDictionary.cpp
+++ lldb/source/Interpreter/OptionValueDictionary.cpp
@@ -83,6 +83,19 @@
   }
 }
 
+llvm::json::Value
+OptionValueDictionary::ToJSON(const ExecutionContext *exe_ctx) {
+  llvm::json::Array dict;
+  for (collection::iterator pos = m_values.begin(); pos != m_values.end();
+       ++pos) {
+    dict.emplace_back(llvm::json::Object{
+        {"key", pos->first.GetCString()},
+        {"value", pos->second->ToJSON(exe_ctx)},
+    });
+  }
+  return std::move(dict);
+}
+
 size_t OptionValueDictionary::GetArgs(Args &args) const {
   args.Clear();
   collection::const_iterator pos, end = m_values.end();
Index: lldb/source/Interpreter/OptionValueArray.cpp
===================================================================
--- lldb/source/Interpreter/OptionValueArray.cpp
+++ lldb/source/Interpreter/OptionValueArray.cpp
@@ -75,6 +75,15 @@
   }
 }
 
+llvm::json::Value OptionValueArray::ToJSON(const ExecutionContext *exe_ctx) {
+  llvm::json::Array json_array;
+  const uint32_t size = m_values.size();
+  for (uint32_t i = 0; i < size; ++i) {
+    json_array.emplace_back(m_values[i]->ToJSON(exe_ctx));
+  }
+  return std::move(json_array);
+}
+
 Status OptionValueArray::SetValueFromString(llvm::StringRef value,
                                             VarSetOperationType op) {
   Args args(value.str());
Index: lldb/source/Core/UserSettingsController.cpp
===================================================================
--- lldb/source/Core/UserSettingsController.cpp
+++ lldb/source/Core/UserSettingsController.cpp
@@ -53,10 +53,17 @@
 }
 
 void Properties::DumpAllPropertyValues(const ExecutionContext *exe_ctx,
-                                       Stream &strm, uint32_t dump_mask) {
+                                       Stream &strm, uint32_t dump_mask,
+                                       bool is_json) {
   OptionValuePropertiesSP properties_sp(GetValueProperties());
-  if (properties_sp)
-    return properties_sp->DumpValue(exe_ctx, strm, dump_mask);
+  if (!properties_sp)
+    return;
+
+  if (is_json) {
+    llvm::json::Value json = properties_sp->ToJSON(exe_ctx);
+    strm.Printf("%s", llvm::formatv("{0:2}", json).str().c_str());
+  } else
+    properties_sp->DumpValue(exe_ctx, strm, dump_mask);
 }
 
 void Properties::DumpAllDescriptions(CommandInterpreter &interpreter,
@@ -71,11 +78,11 @@
 Status Properties::DumpPropertyValue(const ExecutionContext *exe_ctx,
                                      Stream &strm,
                                      llvm::StringRef property_path,
-                                     uint32_t dump_mask) {
+                                     uint32_t dump_mask, bool is_json) {
   OptionValuePropertiesSP properties_sp(GetValueProperties());
   if (properties_sp) {
     return properties_sp->DumpPropertyValue(exe_ctx, strm, property_path,
-                                            dump_mask);
+                                            dump_mask, is_json);
   }
   Status error;
   error.SetErrorString("empty property list");
Index: lldb/source/API/SBDebugger.cpp
===================================================================
--- lldb/source/API/SBDebugger.cpp
+++ lldb/source/API/SBDebugger.cpp
@@ -436,6 +436,42 @@
   return error;
 }
 
+lldb::SBStructuredData SBDebugger::GetSettings() {
+  LLDB_INSTRUMENT_VA(this);
+
+  SBStructuredData data;
+  if (!m_opaque_sp)
+    return data;
+
+  auto json_strm = std::make_shared<StreamString>();
+  ExecutionContext exe_ctx(
+      m_opaque_sp->GetCommandInterpreter().GetExecutionContext());
+  m_opaque_sp->DumpAllPropertyValues(&exe_ctx, *json_strm, /*dump_mask*/ 0,
+                                     /*is_json*/ true);
+
+  data.m_impl_up->SetObjectSP(
+      StructuredData::ParseJSON(json_strm->GetString().str()));
+  return data;
+}
+
+lldb::SBStructuredData SBDebugger::GetSetting(const char *setting) {
+  LLDB_INSTRUMENT_VA(this, setting);
+
+  SBStructuredData data;
+  if (!m_opaque_sp)
+    return data;
+
+  auto json_strm = std::make_shared<StreamString>();
+  ExecutionContext exe_ctx(
+      m_opaque_sp->GetCommandInterpreter().GetExecutionContext());
+  m_opaque_sp->DumpPropertyValue(&exe_ctx, *json_strm, setting, /*dump_mask*/ 0,
+                                 /*is_json*/ true);
+
+  data.m_impl_up->SetObjectSP(
+      StructuredData::ParseJSON(json_strm->GetString().str()));
+  return data;
+}
+
 FILE *SBDebugger::GetInputFileHandle() {
   LLDB_INSTRUMENT_VA(this);
   if (m_opaque_sp) {
Index: lldb/include/lldb/Target/PathMappingList.h
===================================================================
--- lldb/include/lldb/Target/PathMappingList.h
+++ lldb/include/lldb/Target/PathMappingList.h
@@ -9,10 +9,11 @@
 #ifndef LLDB_TARGET_PATHMAPPINGLIST_H
 #define LLDB_TARGET_PATHMAPPINGLIST_H
 
-#include <map>
-#include <vector>
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/Status.h"
+#include "llvm/Support/JSON.h"
+#include <map>
+#include <vector>
 
 namespace lldb_private {
 
@@ -41,6 +42,8 @@
   // By default, dump all pairs.
   void Dump(Stream *s, int pair_index = -1);
 
+  llvm::json::Value ToJSON();
+
   bool IsEmpty() const { return m_pairs.empty(); }
 
   size_t GetSize() const { return m_pairs.size(); }
Index: lldb/include/lldb/Interpreter/OptionValueUUID.h
===================================================================
--- lldb/include/lldb/Interpreter/OptionValueUUID.h
+++ lldb/include/lldb/Interpreter/OptionValueUUID.h
@@ -29,6 +29,10 @@
   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
                  uint32_t dump_mask) override;
 
+  llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override {
+    return m_uuid.GetAsString();
+  }
+
   Status
   SetValueFromString(llvm::StringRef value,
                      VarSetOperationType op = eVarSetOperationAssign) override;
Index: lldb/include/lldb/Interpreter/OptionValueUInt64.h
===================================================================
--- lldb/include/lldb/Interpreter/OptionValueUInt64.h
+++ lldb/include/lldb/Interpreter/OptionValueUInt64.h
@@ -38,6 +38,10 @@
   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
                  uint32_t dump_mask) override;
 
+  llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override {
+    return m_current_value;
+  }
+
   Status
   SetValueFromString(llvm::StringRef value,
                      VarSetOperationType op = eVarSetOperationAssign) override;
Index: lldb/include/lldb/Interpreter/OptionValueString.h
===================================================================
--- lldb/include/lldb/Interpreter/OptionValueString.h
+++ lldb/include/lldb/Interpreter/OptionValueString.h
@@ -69,6 +69,10 @@
   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
                  uint32_t dump_mask) override;
 
+  llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override {
+    return m_current_value;
+  }
+
   Status
   SetValueFromString(llvm::StringRef value,
                      VarSetOperationType op = eVarSetOperationAssign) override;
@@ -109,7 +113,7 @@
   bool IsCurrentValueEmpty() const { return m_current_value.empty(); }
 
   bool IsDefaultValueEmpty() const { return m_default_value.empty(); }
-  
+
   void SetValidator(ValidatorCallback validator, void *baton = nullptr) {
     m_validator = validator;
     m_validator_baton = baton;
Index: lldb/include/lldb/Interpreter/OptionValueSInt64.h
===================================================================
--- lldb/include/lldb/Interpreter/OptionValueSInt64.h
+++ lldb/include/lldb/Interpreter/OptionValueSInt64.h
@@ -35,6 +35,10 @@
   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
                  uint32_t dump_mask) override;
 
+  llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override {
+    return m_current_value;
+  }
+
   Status
   SetValueFromString(llvm::StringRef value,
                      VarSetOperationType op = eVarSetOperationAssign) override;
Index: lldb/include/lldb/Interpreter/OptionValueRegex.h
===================================================================
--- lldb/include/lldb/Interpreter/OptionValueRegex.h
+++ lldb/include/lldb/Interpreter/OptionValueRegex.h
@@ -28,6 +28,10 @@
   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
                  uint32_t dump_mask) override;
 
+  llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override {
+    return m_regex.GetText();
+  }
+
   Status
   SetValueFromString(llvm::StringRef value,
                      VarSetOperationType op = eVarSetOperationAssign) override;
Index: lldb/include/lldb/Interpreter/OptionValueProperties.h
===================================================================
--- lldb/include/lldb/Interpreter/OptionValueProperties.h
+++ lldb/include/lldb/Interpreter/OptionValueProperties.h
@@ -47,11 +47,13 @@
   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
                  uint32_t dump_mask) override;
 
+  llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override;
+
   ConstString GetName() const override { return m_name; }
 
   virtual Status DumpPropertyValue(const ExecutionContext *exe_ctx,
                                    Stream &strm, llvm::StringRef property_path,
-                                   uint32_t dump_mask);
+                                   uint32_t dump_mask, bool is_json = false);
 
   virtual void DumpAllDescriptions(CommandInterpreter &interpreter,
                                    Stream &strm) const;
Index: lldb/include/lldb/Interpreter/OptionValuePathMappings.h
===================================================================
--- lldb/include/lldb/Interpreter/OptionValuePathMappings.h
+++ lldb/include/lldb/Interpreter/OptionValuePathMappings.h
@@ -29,6 +29,8 @@
   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
                  uint32_t dump_mask) override;
 
+  llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override;
+
   Status
   SetValueFromString(llvm::StringRef value,
                      VarSetOperationType op = eVarSetOperationAssign) override;
Index: lldb/include/lldb/Interpreter/OptionValueLanguage.h
===================================================================
--- lldb/include/lldb/Interpreter/OptionValueLanguage.h
+++ lldb/include/lldb/Interpreter/OptionValueLanguage.h
@@ -33,6 +33,8 @@
   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
                  uint32_t dump_mask) override;
 
+  llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override;
+
   Status
   SetValueFromString(llvm::StringRef value,
                      VarSetOperationType op = eVarSetOperationAssign) override;
Index: lldb/include/lldb/Interpreter/OptionValueDictionary.h
===================================================================
--- lldb/include/lldb/Interpreter/OptionValueDictionary.h
+++ lldb/include/lldb/Interpreter/OptionValueDictionary.h
@@ -34,6 +34,8 @@
   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
                  uint32_t dump_mask) override;
 
+  llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override;
+
   Status
   SetValueFromString(llvm::StringRef value,
                      VarSetOperationType op = eVarSetOperationAssign) override;
Index: lldb/include/lldb/Interpreter/OptionValueChar.h
===================================================================
--- lldb/include/lldb/Interpreter/OptionValueChar.h
+++ lldb/include/lldb/Interpreter/OptionValueChar.h
@@ -30,6 +30,13 @@
   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
                  uint32_t dump_mask) override;
 
+  llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override {
+    if (m_current_value != '\0')
+      return m_current_value;
+    else
+      return "(null)";
+  }
+
   Status
   SetValueFromString(llvm::StringRef value,
                      VarSetOperationType op = eVarSetOperationAssign) override;
Index: lldb/include/lldb/Interpreter/OptionValueBoolean.h
===================================================================
--- lldb/include/lldb/Interpreter/OptionValueBoolean.h
+++ lldb/include/lldb/Interpreter/OptionValueBoolean.h
@@ -29,6 +29,10 @@
   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
                  uint32_t dump_mask) override;
 
+  llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override {
+    return m_current_value;
+  }
+
   Status
   SetValueFromString(llvm::StringRef value,
                      VarSetOperationType op = eVarSetOperationAssign) override;
Index: lldb/include/lldb/Interpreter/OptionValueArray.h
===================================================================
--- lldb/include/lldb/Interpreter/OptionValueArray.h
+++ lldb/include/lldb/Interpreter/OptionValueArray.h
@@ -29,6 +29,8 @@
   void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
                  uint32_t dump_mask) override;
 
+  llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override;
+
   Status
   SetValueFromString(llvm::StringRef value,
                      VarSetOperationType op = eVarSetOperationAssign) override;
Index: lldb/include/lldb/Interpreter/OptionValue.h
===================================================================
--- lldb/include/lldb/Interpreter/OptionValue.h
+++ lldb/include/lldb/Interpreter/OptionValue.h
@@ -17,6 +17,7 @@
 #include "lldb/lldb-defines.h"
 #include "lldb/lldb-private-enumerations.h"
 #include "lldb/lldb-private-interfaces.h"
+#include "llvm/Support/JSON.h"
 
 namespace lldb_private {
 
@@ -82,6 +83,12 @@
   virtual void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
                          uint32_t dump_mask) = 0;
 
+  // TODO: make this function pure virtual after implementing it in all
+  // child classes.
+  virtual llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) {
+    return llvm::json::Value("<not yet implemented>");
+  }
+
   virtual Status
   SetValueFromString(llvm::StringRef value,
                      VarSetOperationType op = eVarSetOperationAssign);
Index: lldb/include/lldb/Core/UserSettingsController.h
===================================================================
--- lldb/include/lldb/Core/UserSettingsController.h
+++ lldb/include/lldb/Core/UserSettingsController.h
@@ -57,10 +57,11 @@
 
   virtual Status DumpPropertyValue(const ExecutionContext *exe_ctx,
                                    Stream &strm, llvm::StringRef property_path,
-                                   uint32_t dump_mask);
+                                   uint32_t dump_mask, bool is_json = false);
 
   virtual void DumpAllPropertyValues(const ExecutionContext *exe_ctx,
-                                     Stream &strm, uint32_t dump_mask);
+                                     Stream &strm, uint32_t dump_mask,
+                                     bool is_json = false);
 
   virtual void DumpAllDescriptions(CommandInterpreter &interpreter,
                                    Stream &strm) const;
Index: lldb/include/lldb/API/SBDebugger.h
===================================================================
--- lldb/include/lldb/API/SBDebugger.h
+++ lldb/include/lldb/API/SBDebugger.h
@@ -115,6 +115,10 @@
 
   void Clear();
 
+  lldb::SBStructuredData GetSettings();
+
+  lldb::SBStructuredData GetSetting(const char *setting);
+
   void SetAsync(bool b);
 
   bool GetAsync();
Index: lldb/bindings/interface/SBDebugger.i
===================================================================
--- lldb/bindings/interface/SBDebugger.i
+++ lldb/bindings/interface/SBDebugger.i
@@ -225,6 +225,10 @@
         }
     }
 
+    lldb::SBStructuredData GetSettings();
+
+    lldb::SBStructuredData GetSetting(const char *setting);
+
     SBError
     SetInputString (const char* data);
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to