Reputation: 1766
For gdb, I can use either a .gdb_debug_scripts
section or a file naming convention ($BINARY-gdb.py
or $LIBRARY-gdb.py
) to specify that when that object file is loaded into gdb, the extension code should be invoked.
Does LLDB have equivalent functionality?
Upvotes: 2
Views: 99
Reputation: 51
I can't find good official docs (it is mentioned...) but you can create a ~/.lldbinit
and also have one at the root of your project. More at https://github.com/pytorch/pytorch/blob/main/.lldbinit#L6:
# automatically load the pytorch_lldb extension.
#
# lldb automatically tries to load this file whenever it is executed from the
# root of the pytorch repo, but by default it is not allowed to do so due to
# security reasons. If you want to use pytorch_lldb, please add the following
# line to your ~/.lldbinit (i.e., the .lldbinit file which is in your home
# directory, NOT this file):
# settings set target.load-cwd-lldbinit true
# setting set escape-non-printables false
#
# Alternatively, you can manually load the pytorch_lldb commands into your
# existing lldb session by doing the following:
# (lldb) command script import tools/lldb/pytorch_lldb.py
command script import tools/lldb/pytorch_lldb.py
setting set escape-non-printables false
type category enable torch
Upvotes: 1