virtual bool CheckObjectExists(const char *name) { return false; }
virtual bool
- LoadScriptingModule(const char *filename, bool can_reload, bool init_session,
+ LoadScriptingModule(const char *filename, bool init_session,
lldb_private::Status &error,
StructuredData::ObjectSP *module_sp = nullptr);
switch (short_option) {
case 'r':
- m_allow_reload = true;
+ // NO-OP
break;
default:
llvm_unreachable("Unimplemented option");
}
void OptionParsingStarting(ExecutionContext *execution_context) override {
- m_allow_reload = true;
}
llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
return llvm::makeArrayRef(g_script_import_options);
}
-
- // Instance variables to hold the values for command options.
-
- bool m_allow_reload;
};
bool DoExecute(Args &command, CommandReturnObject &result) override {
// more)
m_exe_ctx.Clear();
if (GetDebugger().GetScriptInterpreter()->LoadScriptingModule(
- entry.c_str(), m_options.m_allow_reload, init_session, error)) {
+ entry.c_str(), init_session, error)) {
result.SetStatus(eReturnStatusSuccessFinishNoResult);
} else {
result.AppendErrorWithFormat("module importing failed: %s",
}
StreamString scripting_stream;
scripting_fspec.Dump(scripting_stream.AsRawOstream());
- const bool can_reload = true;
const bool init_lldb_globals = false;
bool did_load = script_interpreter->LoadScriptingModule(
- scripting_stream.GetData(), can_reload, init_lldb_globals,
- error);
+ scripting_stream.GetData(), init_lldb_globals, error);
if (!did_load)
return false;
}
}
bool ScriptInterpreter::LoadScriptingModule(
- const char *filename, bool can_reload, bool init_session,
- lldb_private::Status &error, StructuredData::ObjectSP *module_sp) {
+ const char *filename, bool init_session, lldb_private::Status &error,
+ StructuredData::ObjectSP *module_sp) {
error.SetErrorString(
"This script interpreter does not support importing modules.");
return false;
python_module_path.GetFilename().AsCString(""));
if (!os_plugin_class_name.empty()) {
const bool init_session = false;
- const bool allow_reload = true;
char python_module_path_cstr[PATH_MAX];
python_module_path.GetPath(python_module_path_cstr,
sizeof(python_module_path_cstr));
Status error;
- if (m_interpreter->LoadScriptingModule(
- python_module_path_cstr, allow_reload, init_session, error)) {
+ if (m_interpreter->LoadScriptingModule(python_module_path_cstr,
+ init_session, error)) {
// Strip the ".py" extension if there is one
size_t py_extension_pos = os_plugin_class_name.rfind(".py");
if (py_extension_pos != std::string::npos)
StructuredData::ObjectSP module_sp;
- if (LoadScriptingModule(file_spec.GetPath().c_str(), true, true, error,
- &module_sp))
+ if (LoadScriptingModule(file_spec.GetPath().c_str(), true, error, &module_sp))
return module_sp;
return StructuredData::ObjectSP();
}
bool ScriptInterpreterPythonImpl::LoadScriptingModule(
- const char *pathname, bool can_reload, bool init_session,
- lldb_private::Status &error, StructuredData::ObjectSP *module_sp) {
+ const char *pathname, bool init_session, lldb_private::Status &error,
+ StructuredData::ObjectSP *module_sp) {
if (!pathname || !pathname[0]) {
error.SetErrorString("invalid pathname");
return false;
bool was_imported = (was_imported_globally || was_imported_locally);
- if (was_imported && !can_reload) {
- error.SetErrorString("module already imported");
- return false;
- }
-
// now actually do the import
command_stream.Clear();
std::string &output, Status &error) override;
bool
- LoadScriptingModule(const char *filename, bool can_reload, bool init_session,
+ LoadScriptingModule(const char *filename, bool init_session,
lldb_private::Status &error,
StructuredData::ObjectSP *module_sp = nullptr) override;