Files imported by the script interpreter aren't opened by LLDB so they don't end up in the reproducer. The solution is to explicitly add them to the FileCollector.
Details
- Reviewers
labath aprantl - Group Reviewers
Restricted Project - Commits
- rGfbde3a2d271b: [lldb/Reproducers] Collect files imported by command script import
rG1f80e51546bf: [lldb/Reproducers] Collect files imported by command script import
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This seems fine with a (fairly big) caveat that this approach will not work transitively loaded modules (== if the "command script import"ed module imports another module on its own). Supporting this would be possible, but it would require hooking fairly deep into the module loading mechanism of respective language. In lua, I believe that could be achieved by overriding the builtin loadfile function (to save the file when recording, and substitute it during replay). In python, that might be achieved by overriding the __import__ function to record the module file name and by adjusting the module import mechanism (perhaps via import hooks) on replay.
However, all of that is going to be fairly tricky code, so I don't think that's needed if you just want to make simple imports work.