Fix error handling when there are no REPLs installed.

Before, in the absence of any configured REPLs, LLDB would act as if there were
multiple possible REPL options, whereas actually no REPL language is supported.
Now we make a better error.

llvm-svn: 250931
This commit is contained in:
Sean Callanan 2015-10-21 19:31:17 +00:00
parent 9ac7a6c51f
commit 97f84e870f
2 changed files with 28 additions and 1 deletions

View File

@ -1806,6 +1806,28 @@ Debugger::RunREPL (LanguageType language, const char *repl_options)
Error err;
FileSpec repl_executable;
if (language == eLanguageTypeUnknown)
{
std::set<LanguageType> repl_languages;
Language::GetLanguagesSupportingREPLs(repl_languages);
if (repl_languages.size() == 1)
{
language = *repl_languages.begin();
}
else if (repl_languages.size() == 0)
{
err.SetErrorStringWithFormat("LLDB isn't configured with support support for any REPLs.");
return err;
}
else
{
err.SetErrorStringWithFormat("Multiple possible REPL languages. Please specify a language.");
return err;
}
}
Target *const target = nullptr; // passing in an empty target means the REPL must create one
REPLSP repl_sp(REPL::Create(err, language, this, target, repl_options));

View File

@ -226,10 +226,15 @@ Target::GetREPL (Error &err, lldb::LanguageType language, const char *repl_optio
{
language = *repl_languages.begin();
}
else if (repl_languages.size() == 0)
{
err.SetErrorStringWithFormat("LLDB isn't configured with support support for any REPLs.");
return REPLSP();
}
else
{
err.SetErrorStringWithFormat("Multiple possible REPL languages. Please specify a language.");
return REPLSP(); // must provide a language
return REPLSP();
}
}