[lldb-dev] Python script stuck when trying to continue process in lldb

Greg Clayton gclayton at apple.com
Thu May 15 10:31:06 PDT 2014


> On May 15, 2014, at 9:30 AM, Jason Dinh Ba Thanh <bathanh at gmail.com> wrote:
> 
> I'm trying to do some research on iOS and it involves attaching lldb to a process. I'm able to do it with lldb console, however when I'm trying to convert it to a python script, it stuck at "process continue" for the first time and never reach the commands at the end. Can anyone helps? Thanks.
> 
> The code: http://pastebin.com/Yi380xFe
> 
> I tried to get the attached process by "process = debugger.GetSelectedTarget().GetProcess()" and call "process.Continue()" but I'm getting the same result.


I would try using the API a bit more instead of HandleCommand. Your original code:

import lldb
debugger = lldb.SBDebugger.Create()
debugger.SetAsync(False)
debugger.HandleCommand('platform select remote-ios')
debugger.HandleCommand('process connect connect://localhost:1234')
debugger.HandleCommand('process continue')

New code using the API is a much better way:

import lldb
debugger = lldb.SBDebugger.Create()
filename = None # fill this in if you know the local version of the executable file, else leave as None
triple = 'armv7s-apple-ios' # Modify the ARM architecture to match
platform = 'remote-ios'
error = lldb.SBError()
target = CreateTarget (filename, triple, platform, False, error)
if target.IsValid():
    process = target.ConnectRemote(debugger, "connect://localhost:1234", "gdb-remote", error)
    if process.IsValid():
        process.Continue()




More information about the lldb-dev mailing list