[lldb-dev] run after process stop using python API
egranata at apple.com
Wed Jun 26 14:06:40 PDT 2013
$ ./lldb /bin/ls
Current executable set to '/bin/ls' (x86_64).
(lldb) b malloc
Breakpoint 1: 2 locations.
Process 48448 launched: '/bin/ls' (x86_64)
Process 48448 stopped
* thread #1: tid = 0x58fee, 0x00007fff906cd8f9 libsystem_malloc.dylib`malloc, stop reason = breakpoint 1.2
frame #0: 0x00007fff906cd8f9 libsystem_malloc.dylib`malloc
-> 0x7fff906cd8f9: pushq %rbp
0x7fff906cd8fa: movq %rsp, %rbp
0x7fff906cd8fd: pushq %rbx
0x7fff906cd8fe: pushq %rax
There is a running process, kill it and restart?: [Y/n] <— this is where you are hung waiting for input
You probably want to say i.HandleCommand(“c”,res)
OTOH, I wonder if we could do any better w.r.t. handling commands that require input - I think in our test suite, to do that kind of thing, we use pexpect to read/write from/to LLDB’s stdin/stdout
And with all of that said, if you are trying to do any serious instrumentation of your process, you might want to consider using the LLDB event model instead of HandleCommand() scripting.
An example of how you would do that in Python is in our source base at examples/python/process_events.py and (for the C++ way) in the lldb-perf project
On Jun 26, 2013, at 1:57 PM, Langmuir, Ben <ben.langmuir at intel.com> wrote:
> I’m trying to use the ‘run’ command from the python API when my process has stopped at a breakpoint, but it appears to hang. Script attached.
> i.HandleCommand('b main', res)
> i.HandleCommand('r', res) -> runs to breakpoint correctly
> i.HandleCommand('r', res) -> appears to hang
> This seems like a bug, but I thought I would ask in case the interpreter was waiting for some kind of input I wasn’t providing… I’m running on Linux, and haven’t had a chance to try OS X yet.
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the lldb-dev