Thanks!
SBValue.process works!
I have another script that I run manually to search process memory for certain patterns, not a type summary provider, there is no SBValue passed to my script, in such a case, how do I get current process?
Thanks!
SBValue.process works!
I have another script that I run manually to search process memory for certain patterns, not a type summary provider, there is no SBValue passed to my script, in such a case, how do I get current process?
Thanks!
SBValue.process works!I have another script that I run manually to search process memory for certain patterns, not a type summary provider, there is no SBValue passed to my script, in such a case, how do I get current process?
If this is python a command line command you are making, use the variant that takes an execution context:
def my_command(debugger, command, exe_ctx, result, dict):
# Always use the specified execution context to get the target, process
# thread and frame. If this command gets run from a breakpoint callback
# these will not match the debugger's selected target, the selected
# process in the target, the selected thread in the process and the
# selected frame in the thread.
target = exe_ctx.GetTarget()
process = exe_ctx.GetProcess()
thread = exe_ctx.GetThread()
frame = exe_ctx.GetFrame()
The execution context is explicitly specified for you.
Does the following qualify as “interactive usage”? It seems using “process” works in myfile.func(), or I was just lucky? Thanks.
(lldb) script myfile.func(args)
Yes, the "script" command always sets up the lldb.{process/thread/frame} regardless of whether its input is one-line or from the Script Input reader. The help for script should specify that.
Jim
When using the "script" command, lldb.process/thread/frame are always setup so you can use them _in_your_text_, but you probably shouldn't rely on them being setup inside your function. You should pass the process to it:
(lldb) script myfile.func(lldb.process, args)
Then you can use "myfile.func" from any other function, including one that comes from a command, breakpoint python function, etc and the process will always be specified. If you wan't to run a python function as a new LLDB command, install a new command line command:
http://lldb.llvm.org/python-reference.html
See the section named: CREATE A NEW LLDB COMMAND USING A PYTHON FUNCTION
Greg