brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 9122f8f Raw
41 lines · plain
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 Python13module given its full pathname.14The command works by extending Python's sys.path lookup to include the path to15the module to be imported when required, and then going through the language16ordinary 'import' mechanism. In this respect, modules imported from LLDB command17line 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$ ./lldb21(lldb) script import importcmd22(lldb) command script add import -f importcmd.pyimport_cmd23(lldb) import ../demo.py24(lldb) script demo.test_function('hello world')25I am a Python function that says hello world26(lldb) quit27Enrico-Granatas-MacBook-Pro:Debug enricogranata$ 28 29Of course, the commands to import the importcmd.py module and to define the import30command, can be included in the .lldbinit file to make this feature available at31debugger startup32 33WARNING: The import command defined by importcmd.py is now obsolete34In TOT LLDB, you can say:35(lldb) command script import ../demo.py36(lldb) script demo.test_function('hello world')37I am a Python function that says hello world38(lldb) quit39 40using the native "command script import" command, which offers a superset of what the import command provided by importcmd.py does41