Add a new affordance that the Python module in a dSYM (#133290)
So the dSYM can be told what target it has been loaded into. When lldb is loading modules, while creating a target, it will run "command script import" on any Python modules in Resources/Python in the dSYM. However, this happens WHILE the target is being created, so it is not yet in the target list. That means that these scripts can't act on the target that they a part of when they get loaded. This patch adds a new python API that lldb will call: __lldb_module_added_to_target if it is defined in the module, passing in the Target the module was being added to, so that code in these dSYM's don't have to guess.
This commit is contained in:
1 parent
ec290a43f6
commit
347c5a7af5
12 files changed
+155
-9
No files matched your search
@@ -2316,7 +2316,7 @@ uint64_t replace_all(std::string &str, const std::string &oldStr,
|
||||
bool ScriptInterpreterPythonImpl::LoadScriptingModule(
|
||||
const char *pathname, const LoadScriptOptions &options,
|
||||
lldb_private::Status &error, StructuredData::ObjectSP *module_sp,
|
||||
FileSpec extra_search_dir) {
|
||||
FileSpec extra_search_dir, lldb::TargetSP target_sp) {
|
||||
namespace fs = llvm::sys::fs;
|
||||
namespace path = llvm::sys::path;
|
||||
|
||||
@@ -2495,6 +2495,12 @@ bool ScriptInterpreterPythonImpl::LoadScriptingModule(
|
||||
PyRefType::Owned, static_cast<PyObject *>(module_pyobj)));
|
||||
}
|
||||
|
||||
// Finally, if we got a target passed in, then we should tell the new module
|
||||
// about this target:
|
||||
if (target_sp)
|
||||
return SWIGBridge::LLDBSwigPythonCallModuleNewTarget(
|
||||
module_name.c_str(), m_dictionary_name.c_str(), target_sp);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user