1*7f01ac39SJohnny ChenFiles in this directory:
2*7f01ac39SJohnny Chen
3*7f01ac39SJohnny Cheno importcmd.py:
4*7f01ac39SJohnny Chen
5*7f01ac39SJohnny ChenPython module which provides implementation for the 'import' command.
6*7f01ac39SJohnny Chen
7*7f01ac39SJohnny Cheno README:
8*7f01ac39SJohnny Chen
9*7f01ac39SJohnny ChenThe file you are reading now.
10*7f01ac39SJohnny Chen
11*7f01ac39SJohnny Chen================================================================================
12*7f01ac39SJohnny ChenThe import command defined by importcmd.py can be used in LLDB to load a Python
13*7f01ac39SJohnny Chenmodule given its full pathname.
14*7f01ac39SJohnny ChenThe command works by extending Python's sys.path lookup to include the path to
15*7f01ac39SJohnny Chenthe module to be imported when required, and then going through the language
16*7f01ac39SJohnny Chenordinary 'import' mechanism. In this respect, modules imported from LLDB command
17*7f01ac39SJohnny Chenline should not be distinguishable from those imported using the script interpreter.
18*7f01ac39SJohnny ChenThe following terminal output shows an interaction with lldb using this new command.
19*7f01ac39SJohnny Chen
20*7f01ac39SJohnny ChenEnrico-Granatas-MacBook-Pro:Debug enricogranata$ ./lldb
21*7f01ac39SJohnny Chen(lldb) script import importcmd
22*7f01ac39SJohnny Chen(lldb) command script add import -f importcmd.pyimport_cmd
23*7f01ac39SJohnny Chen(lldb) import ../demo.py
24*7f01ac39SJohnny Chen(lldb) script demo.test_function('hello world')
25*7f01ac39SJohnny ChenI am a Python function that says hello world
26*7f01ac39SJohnny Chen(lldb) quit
27*7f01ac39SJohnny ChenEnrico-Granatas-MacBook-Pro:Debug enricogranata$
28*7f01ac39SJohnny Chen
29*7f01ac39SJohnny ChenOf course, the commands to import the importcmd.py module and to define the import
30*7f01ac39SJohnny Chencommand, can be included in the .lldbinit file to make this feature available at
31*7f01ac39SJohnny Chendebugger startup
32