<div dir="ltr">Ok.  Can I adjust the comment in RNBRemote.cpp right above this that says "we don't send anything" so at least it reflects this info?  (Something like "We send an X09 response right away to prevent a race condition.").<div>
<br></div><div>I'll then adjust the gdb-remote tests to accommodate Darwin without spewing warnings about unexpected packets.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 15, 2014 at 11:23 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">We end up with a race condition in LLDB if this happens. There are a few things that must happen though:<br>
1 - We need to get a "X09" response back from debugserver in a timely manor<br>
2 - debugserver must live long enough to reap the child process<br>
<br>
The call to DNBProcessKill() is synchronous, so by the time it returns the process should be exited. So we should ensure that only one copy of the "X09" packet gets sent by having RNBRemote verify if this has already been sent or not, and sending it only if it hasn't.<br>

<br>
We ran into problems before if we didn't send this and I don't know what those problems were and if they will re-occur, so I would prefer not to make this debugserver change and just have you adjust your test case for debugserver to avoid any potential problems.<br>

<br>
Greg<br>
<div><div class="h5"><br>
> On Jul 14, 2014, at 1:04 PM, Todd Fiala <<a href="mailto:todd.fiala@gmail.com">todd.fiala@gmail.com</a>> wrote:<br>
><br>
> Currently debugserver sends two responses to the 'k' gdb-remote kill request.  The first one is automatically sent out without question when receiving the 'k' packet.  The second one comes when the process really dies (i.e. the real result, including extra info re: description).<br>

><br>
> This change removes the first automatic 'X09' response, and adjusts the gdb-remote 'k' test to accept the key-val info from the true X response from death of the process on MacOSX.  This change also eliminates a set of verbose warnings from the gdb-remote test suite where the second X results was picked up but was unexpected, never matched, by the test system.<br>

><br>
> llgs already behaves this way.<br>
><br>
> Index: test/tools/lldb-gdbserver/TestLldbGdbServer.py<br>
> ===================================================================<br>
> --- test/tools/lldb-gdbserver/TestLldbGdbServer.py    (revision 212951)<br>
> +++ test/tools/lldb-gdbserver/TestLldbGdbServer.py    (working copy)<br>
> @@ -408,10 +408,10 @@<br>
><br>
>      def attach_commandline_kill_after_initial_stop(self):<br>
>          procs = self.prep_debug_monitor_and_inferior()<br>
> -        self.test_sequence.add_log_lines(<br>
> -            ["read packet: $k#6b",<br>
> -             "send packet: $X09#00"],<br>
> -            True)<br>
> +        self.test_sequence.add_log_lines([<br>
> +            "read packet: $k#6b",<br>
> +            {"direction":"send", "regex":r"^\$X[0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}" },<br>
> +            ], True)<br>
>          self.expect_gdbremote_sequence()<br>
><br>
>          # Wait a moment for completed and now-detached inferior process to clear.<br>
> Index: tools/debugserver/source/RNBRemote.cpp<br>
> ===================================================================<br>
> --- tools/debugserver/source/RNBRemote.cpp    (revision 212951)<br>
> +++ tools/debugserver/source/RNBRemote.cpp    (working copy)<br>
> @@ -3857,7 +3857,8 @@<br>
>      // No response to should be sent to the kill packet<br>
>      if (m_ctx.HasValidProcessID())<br>
>          DNBProcessKill (m_ctx.ProcessID());<br>
> -    SendPacket ("X09");<br>
> +    // Don't send the X - wait for the real process death to do that.<br>
> +    // Otherwise, we get two X stop notifications for the process death.<br>
>      return rnb_success;<br>
>  }<br>
><br>
> --<br>
> -Todd<br>
</div></div>> <patch_gdbremote_k_one_response.diff>_______________________________________________<br>
> lldb-commits mailing list<br>
> <a href="mailto:lldb-commits@cs.uiuc.edu">lldb-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits</a><br>
<br>
_______________________________________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@cs.uiuc.edu">lldb-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits</a><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>