This is an archive of the discontinued LLVM Phabricator instance.

[lldb/Reproducers] Collect files imported by command script import
ClosedPublic

Authored by JDevlieghere on Mar 23 2020, 9:46 AM.

Details

Summary

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.

Diff Detail

Event Timeline

JDevlieghere created this revision.Mar 23 2020, 9:46 AM
labath accepted this revision.Mar 24 2020, 1:13 AM

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.

This revision is now accepted and ready to land.Mar 24 2020, 1:13 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 24 2020, 9:08 AM