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

Jason Dinh Ba Thanh bathanh at gmail.com
Thu May 15 10:52:57 PDT 2014


Should it be:

target = *debugger*.CreateTarget (filename, triple, platform, False, error)

I tried that and get error on this line
    process = target.ConnectRemote(debugger, "connect://localhost:1234",
"gdb-remote", error)

File "lldbControl.py", line 54, in <module>
    process = target.ConnectRemote(debugger, "connect://localhost:1234",
"gdb-remote", error)
  File
"/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/Resources/Python/lldb/__init__.py",
line 7773, in ConnectRemote
    return _lldb.SBTarget_ConnectRemote(self, *args)

This is an iPhone 4 running iOS  7 so I guess it's armv7, right?


Jason


On Fri, May 16, 2014 at 1:31 AM, Greg Clayton <gclayton at apple.com> wrote:

>
> > 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()
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140516/c1e5bcc4/attachment.html>


More information about the lldb-dev mailing list