blob: 4d143bd6c8e3218f51105f38d909eedd129db6e9 [file] [log] [blame]
Johnny Chen7f01ac32011-10-12 20:47:04 +00001Files in this directory:
2
3o importcmd.py:
4
5Python module which provides implementation for the 'import' command.
6
7o README:
8
9The file you are reading now.
10
11================================================================================
12The import command defined by importcmd.py can be used in LLDB to load a Python
13module given its full pathname.
14The command works by extending Python's sys.path lookup to include the path to
15the module to be imported when required, and then going through the language
16ordinary 'import' mechanism. In this respect, modules imported from LLDB command
17line should not be distinguishable from those imported using the script interpreter.
18The following terminal output shows an interaction with lldb using this new command.
19
20Enrico-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')
25I am a Python function that says hello world
26(lldb) quit
27Enrico-Granatas-MacBook-Pro:Debug enricogranata$
28
29Of course, the commands to import the importcmd.py module and to define the import
30command, can be included in the .lldbinit file to make this feature available at
31debugger startup