aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Core/Debugger.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2022-01-27 22:06:42 +0000
committerDimitry Andric <dim@FreeBSD.org>2022-01-27 22:06:42 +0000
commit6f8fc217eaa12bf657be1c6468ed9938d10168b3 (patch)
treea1fd89b864d9b93e2ad68fe1dcf7afee2e3c8d76 /lldb/source/Core/Debugger.cpp
parent77fc4c146f0870ffb09c1afb823ccbe742c5e6ff (diff)
Diffstat (limited to 'lldb/source/Core/Debugger.cpp')
-rw-r--r--lldb/source/Core/Debugger.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index ae454fae3322..49cc21b65951 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -25,6 +25,7 @@
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Interpreter/OptionValue.h"
+#include "lldb/Interpreter/OptionValueLanguage.h"
#include "lldb/Interpreter/OptionValueProperties.h"
#include "lldb/Interpreter/OptionValueSInt64.h"
#include "lldb/Interpreter/OptionValueString.h"
@@ -324,6 +325,20 @@ bool Debugger::SetScriptLanguage(lldb::ScriptLanguage script_lang) {
script_lang);
}
+lldb::LanguageType Debugger::GetREPLLanguage() const {
+ const uint32_t idx = ePropertyREPLLanguage;
+ OptionValueLanguage *value =
+ m_collection_sp->GetPropertyAtIndexAsOptionValueLanguage(nullptr, idx);
+ if (value)
+ return value->GetCurrentValue();
+ return LanguageType();
+}
+
+bool Debugger::SetREPLLanguage(lldb::LanguageType repl_lang) {
+ const uint32_t idx = ePropertyREPLLanguage;
+ return m_collection_sp->SetPropertyAtIndexAsLanguage(nullptr, idx, repl_lang);
+}
+
uint32_t Debugger::GetTerminalWidth() const {
const uint32_t idx = ePropertyTerminalWidth;
return m_collection_sp->GetPropertyAtIndexAsSInt64(
@@ -1753,17 +1768,20 @@ Status Debugger::RunREPL(LanguageType language, const char *repl_options) {
Status err;
FileSpec repl_executable;
+ if (language == eLanguageTypeUnknown)
+ language = GetREPLLanguage();
+
if (language == eLanguageTypeUnknown) {
LanguageSet repl_languages = Language::GetLanguagesSupportingREPLs();
if (auto single_lang = repl_languages.GetSingularLanguage()) {
language = *single_lang;
} else if (repl_languages.Empty()) {
- err.SetErrorStringWithFormat(
+ err.SetErrorString(
"LLDB isn't configured with REPL support for any languages.");
return err;
} else {
- err.SetErrorStringWithFormat(
+ err.SetErrorString(
"Multiple possible REPL languages. Please specify a language.");
return err;
}