[Lldb-commits] [lldb] r250931 - Fix error handling when there are no REPLs installed.

Sean Callanan via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 21 12:31:17 PDT 2015


Author: spyffe
Date: Wed Oct 21 14:31:17 2015
New Revision: 250931

URL: http://llvm.org/viewvc/llvm-project?rev=250931&view=rev
Log:
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.

Modified:
    lldb/trunk/source/Core/Debugger.cpp
    lldb/trunk/source/Target/Target.cpp

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=250931&r1=250930&r2=250931&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Wed Oct 21 14:31:17 2015
@@ -1806,6 +1806,28 @@ Debugger::RunREPL (LanguageType language
     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));

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=250931&r1=250930&r2=250931&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Wed Oct 21 14:31:17 2015
@@ -226,10 +226,15 @@ Target::GetREPL (Error &err, lldb::Langu
         {
             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();
         }
     }
     




More information about the lldb-commits mailing list