<div dir="ltr"><div>Hey Greg,</div><div><br></div>I have this implemented locally, just working through an issue where lldb gets hung when attached to debugserver, waiting for the inferior's initial state change to become stopped.<div>
<br></div><div>I'm seeing a few test failures as well, going back to top of tree to see if I'm introducing them.</div><div><br></div><div>What's the best practice for using the output directory settings in Xcode? Right now I'm using the ~/Library/Developer/Xcode/DerivedData/{some-generated-name-here} directory. I'm then using a soft link to that directory as the '--executable=' part of the test runner. What do you guys do for build output, and how do you run tests?</div>
<div><br></div><div>Thanks!</div><div><br></div><div>-Todd</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 6, 2014 at 11:42 AM, Todd Fiala <span dir="ltr"><<a href="mailto:todd.fiala@gmail.com" target="_blank">todd.fiala@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Ok. I'll get that patched up and make sure all the tests passing before are still passing afterwards.</div>
<div class="gmail_extra"><div><div class="h5"><br><br><div class="gmail_quote">On Tue, May 6, 2014 at 11:33 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><br>
On May 6, 2014, at 10:58 AM, Todd Fiala <<a href="mailto:todd.fiala@gmail.com" target="_blank">todd.fiala@gmail.com</a>> wrote:<br>
<br>
> It appears gdbserver really returns the thread id as documented.<br>
><br>
> Greg - I can get a patch together so we follow the documented protocol in lldb. Before I look at that, is there any side effect you'd be concerned about with moving the $QC response to report the current thread-id?<br>
<br>
</div>LLDB currently assumes that qC responds with the PID of the process. Any change we do will require a change over to using the qProcessInfo packet, and if the qProcessInfo doesn't work it should fall back onto the old qC packet behavior. All old debugserver binaries that are built into old iOS developer disk images still need to work, so we have to make sure we don't ruin that.<br>
<br>
So to fix this we should modify:<br>
<br>
GDBRemoteCommunicationClient::GetCurrentProcessID()<br>
<br>
to call GDBRemoteCommunicationClient::GetCurrentProcessInfo() and see if we have process info. If we do, we will need to modify:<br>
<br>
GDBRemoteCommunicationClient::GetCurrentProcessInfo()<br>
<br>
to cache all of the returned (I don't see it caching the returned pid). Then we return the process ID if all goes well. Else we should fall back to returning the result of the "qC" packet for only for "arm*-apple-ios" targets just to make sure we don't break iOS.<br>
<div><div><br>
<br>
><br>
> Thanks,<br>
> Todd<br>
><br>
><br>
> On Tue, May 6, 2014 at 8:27 AM, Todd Fiala <<a href="mailto:todd.fiala@gmail.com" target="_blank">todd.fiala@gmail.com</a>> wrote:<br>
> I see the issue.<br>
><br>
> In debugserver and lldb-platform's impl (which llgs uses), qC is returning the process id. I *think* this is wrong according to the gdb remote protocol, per the protocol documentation here:<br>
><br>
> ‘qC’<br>
> Return the current thread ID.<br>
> Reply:<br>
><br>
> ‘QC thread-id’<br>
> Where thread-id is a thread ID as documented in thread-id syntax.<br>
> ‘(anything else)’<br>
> Any other reply implies the old thread ID.<br>
><br>
> This raises a general question. If we have the protocol documented and we're not following it exactly (and provided the documentation isn't just plain wrong even for gdb), do we want to fix up lldb to match the protocol? Or do we keep things the same, and document that we're deviating form the protocol as written? I'd prefer to match the protocol for spec-following and iteroperability reasons.<br>
><br>
> In the case of Linux, this issue wouldn't be discovered in the case of launching a process since the process id happens to also be the thread id of the first thread - hence this case the actual use of the pid instead of the tid in the $QC response packet wasn't detected.<br>
><br>
> Let me know what you think and I'll fix it up (including the RNBRemote side). I may swing over to gdb/gdbremote from MacOSX homebrew/MacPorts to see if gdb really uses the thread id or the process id - that will at least rule out if the docs are correct.<br>
><br>
> -Todd<br>
><br>
><br>
> On Mon, May 5, 2014 at 10:45 PM, Todd Fiala <<a href="mailto:todd.fiala@gmail.com" target="_blank">todd.fiala@gmail.com</a>> wrote:<br>
> Hi Greg,<br>
><br>
> I'm about to add a protocol-level test for llgs and debugserver that verifies that a launched inferior process's initial reported thread (i.e. response to $qC) is the same thread that reports when asking for stop state ($?), or at least that the thread-id is present in the threads listed when QListThreadsInStopReply is available. What I'm finding on debugserver on MacOSX is that right after the successful launch with $A, the $qC query responds with a $QC{thread-id}. The very next $?, though, without any intervening resume operation, lists the threads but doesn't contain the {thread-id} from the $QC.<br>
><br>
> Here's a real transcript (with non-interesting bits removed). It's from a debugserver started with no inferior, then attached to by lldb, then launching the first inferior process.<br>
><br>
> ...<br>
> <lldb.driver.main-thread> < 27> send packet: $QListThreadsInStopReply#21<br>
> <lldb.driver.main-thread> < 6> read packet: $OK#00<br>
> <lldb.driver.main-thread> < 13> send packet: $qHostInfo#9b<br>
> <lldb.driver.main-thread> < 122> read packet: $cputype:16777223;cpusubtype:3;ostype:macosx;watchpoint_exceptions_received:after;vendor:apple;endian:little;ptrsize:8;#00<br>
> ...<br>
> <lldb.driver.main-thread> < 66> send packet: $A56,0,2f55736572732f746669616c612f706c61792f6370702f68656c6c6f#a0<br>
> <lldb.driver.main-thread> < 6> read packet: $OK#00<br>
> <lldb.driver.main-thread> < 18> send packet: $qLaunchSuccess#a5<br>
> <lldb.driver.main-thread> < 6> read packet: $OK#00<br>
> <lldb.driver.main-thread> < 6> send packet: $qC#b4<br>
> <lldb.driver.main-thread> < 9> read packet: $QC980#00 <<< Doesn't this say the app is launched, stopped, and thread-id 980 is selected?<br>
> <lldb.driver.main-thread> < 5> send packet: $?#3f<br>
> <lldb.driver.main-thread> < 503> read packet: $T11thread:63f5;qaddr:a0;threads:63f5;00:0000000000000000;01:0000000000000000;02:0000000000000000;03:0000000000000000;04:0000000000000000;05:0000000000000000;06:0000000000000000;07:68f8bf5fff7f0000;08:0000000000000000;09:0000000000000000;0a:0000000000000000;0b:0000000000000000;0c:0000000000000000;0d:0000000000000000;0e:0000000000000000;0f:0000000000000000;10:2810c05fff7f0000;11:0002000000000000;12:2b00000000000000;13:0000000000000000;14:0000000000000000;metype:5;mecount:2;medata:10003;medata:11;#00<br>
> ...<br>
><br>
> The $? response seems to say it only has one thread, 63f5. I would expect at least the 980 thread-id reported in the initial qC packet to exist somewhere.<br>
><br>
> What am I missing?<br>
><br>
> Thanks!<br>
><br>
> --<br>
> -Todd<br>
><br>
><br>
><br>
> --<br>
> -Todd<br>
><br>
><br>
><br>
> --<br>
> -Todd<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div></div></div><span class="HOEnZb"><font color="#888888">-- <br><div dir="ltr">-Todd</div>
</font></span></div>
<br>_______________________________________________<br>
lldb-dev mailing list<br>
<a href="mailto:lldb-dev@cs.uiuc.edu">lldb-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><table cellspacing="0" cellpadding="0" style="color:rgb(136,136,136);font-family:'Times New Roman'"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small">
<td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Todd Fiala |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tfiala@google.com" style="color:rgb(17,85,204)" target="_blank"><span style="background-color:rgb(255,255,204);color:rgb(34,34,34);background-repeat:initial initial">tfiala@google.com</span></a> |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"><font color="#1155cc"> <a>650-943-3180</a></font></td></tr></tbody></table><br></div>
</div>