summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/ScriptInterpreterPython.cpp
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2013-05-31 01:03:09 +0000
committerEnrico Granata <egranata@apple.com>2013-05-31 01:03:09 +0000
commite0c70f1b2c4f05ca1e3333015faac4c87d814403 (patch)
tree6c593471f230f1a4e8bac55ae6c7ff9c4e00dfe4 /lldb/source/Interpreter/ScriptInterpreterPython.cpp
parenta2b7720618b7cadb6e8dd07941261a0bf6837986 (diff)
downloadbcm5719-llvm-e0c70f1b2c4f05ca1e3333015faac4c87d814403.tar.gz
bcm5719-llvm-e0c70f1b2c4f05ca1e3333015faac4c87d814403.zip
<rdar://problem/11109316>
command script import now does reloads - for real If you invoke command script import foo and it detects that foo has already been imported, it will - invoke reload(foo) to reload the module in Python - re-invoke foo.__lldb_init_module This second step is necessary to ensure that LLDB does not keep cached copies of any formatter, command, ... that the module is providing Usual caveats with Python imports persist. Among these: - if you have objects lurking around, reloading the module won't magically update them to reflect changes - if module A imports module B, reloading A won't reload B These are Python-specific issues independent of LLDB that would require more extensive design work The --allow-reload (-r) option is maintained for compatibility with existing scripts, but is clearly documented as redundant - reloading is always enabled whether you use it or not llvm-svn: 182977
Diffstat (limited to 'lldb/source/Interpreter/ScriptInterpreterPython.cpp')
-rw-r--r--lldb/source/Interpreter/ScriptInterpreterPython.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
index b54ef1ca901..da80e0ce0e8 100644
--- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
@@ -2672,7 +2672,10 @@ ScriptInterpreterPython::LoadScriptingModule (const char* pathname,
// now actually do the import
command_stream.Clear();
- command_stream.Printf("import %s",basename.c_str());
+ if (was_imported)
+ command_stream.Printf("reload(%s)",basename.c_str());
+ else
+ command_stream.Printf("import %s",basename.c_str());
bool import_retval = ExecuteMultipleLines(command_stream.GetData(), ScriptInterpreter::ExecuteScriptOptions().SetEnableIO(false).SetSetLLDBGlobals(false).SetMaskoutErrors(false));
PyObject* py_error = PyErr_Occurred(); // per Python docs: "you do not need to Py_DECREF()" the return of this function
OpenPOWER on IntegriCloud