• Home
  • History
  • Annotate
  • only in /external/lldb/examples/customization/import-python/
NameDateSize

..12-Mar-20154 KiB

importcmd.py12-Mar-2015946

README12-Mar-20151.6 KiB

README

1Files 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
32
33WARNING: The import command defined by importcmd.py is now obsolete
34In TOT LLDB, you can say:
35(lldb) command script import ../demo.py
36(lldb) script demo.test_function('hello world')
37I am a Python function that says hello world
38(lldb) quit
39
40using the native "command script import" command, which offers a superset of what the import command provided by importcmd.py does
41