diff options
Diffstat (limited to 'lldb/source/API/SBDebugger.cpp')
| -rw-r--r-- | lldb/source/API/SBDebugger.cpp | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index a854c22bb214..4bb23c3e705c 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -680,6 +680,21 @@ SBDebugger::GetScriptingLanguage(const char *script_language_name) { llvm::StringRef(script_language_name), eScriptLanguageDefault, nullptr); } +SBStructuredData +SBDebugger::GetScriptInterpreterInfo(lldb::ScriptLanguage language) { + LLDB_RECORD_METHOD(SBStructuredData, SBDebugger, GetScriptInterpreterInfo, + (lldb::ScriptLanguage), language); + SBStructuredData data; + if (m_opaque_sp) { + lldb_private::ScriptInterpreter *interp = + m_opaque_sp->GetScriptInterpreter(language); + if (interp) { + data.m_impl_up->SetObjectSP(interp->GetInterpreterInfo()); + } + } + return LLDB_RECORD_RESULT(data); +} + const char *SBDebugger::GetVersionString() { LLDB_RECORD_STATIC_METHOD_NO_ARGS(const char *, SBDebugger, GetVersionString); @@ -1114,7 +1129,7 @@ uint32_t SBDebugger::GetNumAvailablePlatforms() { uint32_t idx = 0; while (true) { - if (!PluginManager::GetPlatformPluginNameAtIndex(idx)) { + if (PluginManager::GetPlatformPluginNameAtIndex(idx).empty()) { break; } ++idx; @@ -1133,23 +1148,19 @@ SBStructuredData SBDebugger::GetAvailablePlatformInfoAtIndex(uint32_t idx) { if (idx == 0) { PlatformSP host_platform_sp(Platform::GetHostPlatform()); - platform_dict->AddStringItem( - name_str, host_platform_sp->GetPluginName().GetStringRef()); + platform_dict->AddStringItem(name_str, host_platform_sp->GetPluginName()); platform_dict->AddStringItem( desc_str, llvm::StringRef(host_platform_sp->GetDescription())); } else if (idx > 0) { - const char *plugin_name = + llvm::StringRef plugin_name = PluginManager::GetPlatformPluginNameAtIndex(idx - 1); - if (!plugin_name) { + if (plugin_name.empty()) { return LLDB_RECORD_RESULT(data); } platform_dict->AddStringItem(name_str, llvm::StringRef(plugin_name)); - const char *plugin_desc = + llvm::StringRef plugin_desc = PluginManager::GetPlatformPluginDescriptionAtIndex(idx - 1); - if (!plugin_desc) { - return LLDB_RECORD_RESULT(data); - } platform_dict->AddStringItem(desc_str, llvm::StringRef(plugin_desc)); } @@ -1787,6 +1798,8 @@ template <> void RegisterMethods<SBDebugger>(Registry &R) { (const char *)); LLDB_REGISTER_METHOD(lldb::ScriptLanguage, SBDebugger, GetScriptingLanguage, (const char *)); + LLDB_REGISTER_METHOD(SBStructuredData, SBDebugger, GetScriptInterpreterInfo, + (lldb::ScriptLanguage)); LLDB_REGISTER_STATIC_METHOD(const char *, SBDebugger, GetVersionString, ()); LLDB_REGISTER_STATIC_METHOD(const char *, SBDebugger, StateAsCString, (lldb::StateType)); |
