<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Should it be:</span><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">target = <b>debugger</b>.CreateTarget (filename, triple, platform, False, error)<br>

</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">I tried that and get error on this line </div><div class="im" style="font-family:arial,sans-serif;font-size:13px">

<div>    process = target.ConnectRemote(debugger, "connect://localhost:1234", "gdb-remote", error)</div><div><br></div></div><div style="font-family:arial,sans-serif;font-size:13px"><div>File "lldbControl.py", line 54, in <module></div>

<div class="im">    process = target.ConnectRemote(debugger, "connect://localhost:1234", "gdb-remote", error)</div><div>  File "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/Resources/Python/lldb/__init__.py", line 7773, in ConnectRemote</div>

<div>    return _lldb.SBTarget_ConnectRemote(self, *args)</div></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">This is an iPhone 4 running iOS  7 so I guess it's armv7, right?</div>

</div><div class="gmail_extra"><br clear="all"><div><br>Jason</div>
<br><br><div class="gmail_quote">On Fri, May 16, 2014 at 1:31 AM, Greg Clayton <span dir="ltr"><<a href="mailto:gclayton@apple.com" target="_blank">gclayton@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="HOEnZb"><div class="h5"><br>
> On May 15, 2014, at 9:30 AM, Jason Dinh Ba Thanh <<a href="mailto:bathanh@gmail.com">bathanh@gmail.com</a>> wrote:<br>
><br>
> 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.<br>


><br>
> The code: <a href="http://pastebin.com/Yi380xFe" target="_blank">http://pastebin.com/Yi380xFe</a><br>
><br>
> I tried to get the attached process by "process = debugger.GetSelectedTarget().GetProcess()" and call "process.Continue()" but I'm getting the same result.<br>
<br>
<br>
</div></div>I would try using the API a bit more instead of HandleCommand. Your original code:<br>
<br>
import lldb<br>
debugger = lldb.SBDebugger.Create()<br>
debugger.SetAsync(False)<br>
debugger.HandleCommand('platform select remote-ios')<br>
debugger.HandleCommand('process connect connect://localhost:1234')<br>
debugger.HandleCommand('process continue')<br>
<br>
New code using the API is a much better way:<br>
<br>
import lldb<br>
debugger = lldb.SBDebugger.Create()<br>
filename = None # fill this in if you know the local version of the executable file, else leave as None<br>
triple = 'armv7s-apple-ios' # Modify the ARM architecture to match<br>
platform = 'remote-ios'<br>
error = lldb.SBError()<br>
target = CreateTarget (filename, triple, platform, False, error)<br>
if target.IsValid():<br>
    process = target.ConnectRemote(debugger, "connect://localhost:1234", "gdb-remote", error)<br>
    if process.IsValid():<br>
        process.Continue()<br>
<br>
</blockquote></div><br></div>