diff options
| author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-12-22 16:46:01 -0800 |
|---|---|---|
| committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-12-22 16:47:28 -0800 |
| commit | bd5c8d167b7cce3290d755e29623d047c2ad8e3e (patch) | |
| tree | 5886aa1c8e1240b77fc6dbcbfcb60ece5b874c4c | |
| parent | 2791667d2e3fb8c1f0abaff93fd8caaabb2b00b9 (diff) | |
| download | bcm5719-llvm-bd5c8d167b7cce3290d755e29623d047c2ad8e3e.tar.gz bcm5719-llvm-bd5c8d167b7cce3290d755e29623d047c2ad8e3e.zip | |
[lldb/ScriptInterpreter] Unify error message for command script import
Rather than checking for Python explicitly, let the script interpreter
handle things and print an error if the functionality is not supported.
4 files changed, 11 insertions, 11 deletions
diff --git a/lldb/include/lldb/Interpreter/ScriptInterpreter.h b/lldb/include/lldb/Interpreter/ScriptInterpreter.h index b32962b8035..4b866949514 100644 --- a/lldb/include/lldb/Interpreter/ScriptInterpreter.h +++ b/lldb/include/lldb/Interpreter/ScriptInterpreter.h @@ -459,10 +459,7 @@ public: virtual bool LoadScriptingModule(const char *filename, bool can_reload, bool init_session, lldb_private::Status &error, - StructuredData::ObjectSP *module_sp = nullptr) { - error.SetErrorString("loading unimplemented"); - return false; - } + StructuredData::ObjectSP *module_sp = nullptr); virtual bool IsReservedWord(const char *word) { return false; } diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index b47cc372b4c..36d6b83d115 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -1426,13 +1426,6 @@ protected: }; bool DoExecute(Args &command, CommandReturnObject &result) override { - if (GetDebugger().GetScriptLanguage() != lldb::eScriptLanguagePython) { - result.AppendError("only scripting language supported for module " - "importing is currently Python"); - result.SetStatus(eReturnStatusFailed); - return false; - } - if (command.empty()) { result.AppendError("command script import needs one or more arguments"); result.SetStatus(eReturnStatusFailed); diff --git a/lldb/source/Interpreter/ScriptInterpreter.cpp b/lldb/source/Interpreter/ScriptInterpreter.cpp index 0ef859061ab..c7207db5523 100644 --- a/lldb/source/Interpreter/ScriptInterpreter.cpp +++ b/lldb/source/Interpreter/ScriptInterpreter.cpp @@ -42,6 +42,14 @@ void ScriptInterpreter::CollectDataForWatchpointCommandCallback( "This script interpreter does not support watchpoint callbacks."); } +bool ScriptInterpreter::LoadScriptingModule( + const char *filename, bool can_reload, bool init_session, + lldb_private::Status &error, StructuredData::ObjectSP *module_sp) { + error.SetErrorString( + "This script interpreter does not support importing modules."); + return false; +} + std::string ScriptInterpreter::LanguageToString(lldb::ScriptLanguage language) { switch (language) { case eScriptLanguageNone: diff --git a/lldb/test/Shell/ScriptInterpreter/None/import_module.test b/lldb/test/Shell/ScriptInterpreter/None/import_module.test new file mode 100644 index 00000000000..0af7bfaf24f --- /dev/null +++ b/lldb/test/Shell/ScriptInterpreter/None/import_module.test @@ -0,0 +1,2 @@ +# RUN: %lldb --script-language none -o 'command script import %t' 2>&1 | FileCheck %s +# CHECK: error: module importing failed: This script interpreter does not support importing modules. |

