diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:09:23 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:09:23 +0000 |
| commit | f73363f1dd94996356cefbf24388f561891acf0b (patch) | |
| tree | e3c31248bdb36eaec5fd833490d4278162dba2a0 /source/API/SBDebugger.cpp | |
| parent | 160ee69dd7ae18978f4068116777639ea98dc951 (diff) | |
Notes
Diffstat (limited to 'source/API/SBDebugger.cpp')
| -rw-r--r-- | source/API/SBDebugger.cpp | 70 |
1 files changed, 51 insertions, 19 deletions
diff --git a/source/API/SBDebugger.cpp b/source/API/SBDebugger.cpp index d3294dab582d..a651141003a4 100644 --- a/source/API/SBDebugger.cpp +++ b/source/API/SBDebugger.cpp @@ -11,6 +11,9 @@ // C++ Includes // Other libraries and framework includes // Project includes + +#include "SystemInitializerFull.h" + #include "lldb/API/SBDebugger.h" #include "lldb/lldb-private.h" @@ -35,7 +38,6 @@ #include "lldb/API/SBTypeNameSpecifier.h" #include "lldb/API/SBTypeSummary.h" #include "lldb/API/SBTypeSynthetic.h" -#include "lldb/API/SystemInitializerFull.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/PluginManager.h" @@ -43,12 +45,14 @@ #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" +#include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/OptionGroupPlatform.h" #include "lldb/Target/Process.h" #include "lldb/Target/TargetList.h" +#include "lldb/Utility/Args.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringRef.h" @@ -166,14 +170,10 @@ SBDebugger SBDebugger::Create(bool source_init_files, SBDebugger debugger; // Currently we have issues if this function is called simultaneously on two - // different - // threads. The issues mainly revolve around the fact that the - // lldb_private::FormatManager - // uses global collections and having two threads parsing the .lldbinit files - // can cause - // mayhem. So to get around this for now we need to use a mutex to prevent bad - // things - // from happening. + // different threads. The issues mainly revolve around the fact that the + // lldb_private::FormatManager uses global collections and having two threads + // parsing the .lldbinit files can cause mayhem. So to get around this for + // now we need to use a mutex to prevent bad things from happening. static std::recursive_mutex g_mutex; std::lock_guard<std::recursive_mutex> guard(g_mutex); @@ -218,10 +218,10 @@ void SBDebugger::Destroy(SBDebugger &debugger) { } void SBDebugger::MemoryPressureDetected() { - // Since this function can be call asynchronously, we allow it to be - // non-mandatory. We have seen deadlocks with this function when called - // so we need to safeguard against this until we can determine what is - // causing the deadlocks. + // Since this function can be call asynchronously, we allow it to be non- + // mandatory. We have seen deadlocks with this function when called so we + // need to safeguard against this until we can determine what is causing the + // deadlocks. Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); const bool mandatory = false; @@ -254,9 +254,9 @@ void SBDebugger::SkipAppInitFiles(bool b) { m_opaque_sp->GetCommandInterpreter().SkipAppInitFiles(b); } -// Shouldn't really be settable after initialization as this could cause lots of -// problems; don't want users -// trying to switch modes in the middle of a debugging session. +// Shouldn't really be settable after initialization as this could cause lots +// of problems; don't want users trying to switch modes in the middle of a +// debugging session. void SBDebugger::SetInputFileHandle(FILE *fh, bool transfer_ownership) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); @@ -479,8 +479,8 @@ bool SBDebugger::SetDefaultArchitecture(const char *arch_name) { ScriptLanguage SBDebugger::GetScriptingLanguage(const char *script_language_name) { if (!script_language_name) return eScriptLanguageDefault; - return Args::StringToScriptLanguage(llvm::StringRef(script_language_name), - eScriptLanguageDefault, nullptr); + return OptionArgParser::ToScriptLanguage( + llvm::StringRef(script_language_name), eScriptLanguageDefault, nullptr); } const char *SBDebugger::GetVersionString() { @@ -491,6 +491,38 @@ 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)); +} + +static void AddLLVMTargets(StructuredData::Dictionary &dict) { + auto array_up = llvm::make_unique<StructuredData::Array>(); +#define LLVM_TARGET(target) \ + array_up->AddItem(llvm::make_unique<StructuredData::String>(#target)); +#include "llvm/Config/Targets.def" + auto entry_up = llvm::make_unique<StructuredData::Dictionary>(); + entry_up->AddItem("value", std::move(array_up)); + entry_up->AddStringItem("description", "A list of configured LLVM targets."); + dict.AddItem("targets", 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"); + AddLLVMTargets(*config_up); + + SBStructuredData data; + data.m_impl_up->SetObjectSP(std::move(config_up)); + return data; +} + bool SBDebugger::StateIsRunningState(StateType state) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); |
