summaryrefslogtreecommitdiffstats
path: root/lldb/source/API
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2018-02-19 15:06:28 +0000
committerPavel Labath <labath@google.com>2018-02-19 15:06:28 +0000
commitf1389e92015ae8c5df0579fbf7685f69f4c28955 (patch)
tree426e1aca9b5015cd9102512d6d8ed3b353a7c87e /lldb/source/API
parent07ea77e3bc728dda6faf1feb5592d4958232f6a5 (diff)
downloadbcm5719-llvm-f1389e92015ae8c5df0579fbf7685f69f4c28955.tar.gz
bcm5719-llvm-f1389e92015ae8c5df0579fbf7685f69f4c28955.zip
Add SBDebugger::GetBuildConfiguration and use it to skip an XML test
Summary: This adds a SBDebugger::GetBuildConfiguration static function, which returns a SBStructuredData describing the the build parameters of liblldb. Right now, it just contains one entry: whether we were built with XML support. I use the new functionality to skip a test which requires XML support, but concievably the new function could be useful to other liblldb clients as well (making sure the library supports the feature they are about to use). Reviewers: zturner, jingham, clayborg, davide Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D43333 llvm-svn: 325504
Diffstat (limited to 'lldb/source/API')
-rw-r--r--lldb/source/API/SBDebugger.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index d3294dab582..6f568f4e017 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -43,6 +43,7 @@
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/StructuredDataImpl.h"
#include "lldb/DataFormatters/DataVisualization.h"
+#include "lldb/Host/XML.h"
#include "lldb/Initialization/SystemLifetimeManager.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@@ -491,6 +492,26 @@ const char *SBDebugger::StateAsCString(StateType state) {
return lldb_private::StateAsCString(state);
}
+static void AddBoolConfigEntry(StructuredData::Dictionary &dict,
+ llvm::StringRef name, bool value,
+ llvm::StringRef description) {
+ auto entry_up = llvm::make_unique<StructuredData::Dictionary>();
+ entry_up->AddBooleanItem("value", value);
+ entry_up->AddStringItem("description", description);
+ dict.AddItem(name, std::move(entry_up));
+}
+
+SBStructuredData SBDebugger::GetBuildConfiguration() {
+ auto config_up = llvm::make_unique<StructuredData::Dictionary>();
+ AddBoolConfigEntry(
+ *config_up, "xml", XMLDocument::XMLEnabled(),
+ "A boolean value that indicates if XML support is enabled in LLDB");
+
+ SBStructuredData data;
+ data.m_impl_up->SetObjectSP(std::move(config_up));
+ return data;
+}
+
bool SBDebugger::StateIsRunningState(StateType state) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
OpenPOWER on IntegriCloud