1 Files in this directory: 2 3 o importcmd.py: 4 5 Python module which provides implementation for the 'import' command. 6 7 o README: 8 9 The file you are reading now. 10 11 ================================================================================ 12 The import command defined by importcmd.py can be used in LLDB to load a Python 13 module given its full pathname. 14 The command works by extending Python's sys.path lookup to include the path to 15 the module to be imported when required, and then going through the language 16 ordinary 'import' mechanism. In this respect, modules imported from LLDB command 17 line should not be distinguishable from those imported using the script interpreter. 18 The following terminal output shows an interaction with lldb using this new command. 19 20 Enrico-Granatas-MacBook-Pro:Debug enricogranata$ ./lldb 21 (lldb) script import importcmd 22 (lldb) command script add import -f importcmd.pyimport_cmd 23 (lldb) import ../demo.py 24 (lldb) script demo.test_function('hello world') 25 I am a Python function that says hello world 26 (lldb) quit 27 Enrico-Granatas-MacBook-Pro:Debug enricogranata$ 28 29 Of course, the commands to import the importcmd.py module and to define the import 30 command, can be included in the .lldbinit file to make this feature available at 31 debugger startup 32 33 WARNING: The import command defined by importcmd.py is now obsolete 34 In TOT LLDB, you can say: 35 (lldb) command script import ../demo.py 36 (lldb) script demo.test_function('hello world') 37 I am a Python function that says hello world 38 (lldb) quit 39 40 using the native "command script import" command, which offers a superset of what the import command provided by importcmd.py does 41