<div dir="ltr">Since we don't execute the binary we don't have to, but I agree it would the right thing to do, as something else could depend on it during replay. I'll address this once I figure out what's causing the flakiness on Linux.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 21, 2019 at 1:32 AM Pavel Labath <<a href="mailto:pavel@labath.sk">pavel@labath.sk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">On 21/03/2019 05:08, Jonas Devlieghere via lldb-commits wrote:<br>
> Author: jdevlieghere<br>
> Date: Wed Mar 20 21:08:31 2019<br>
> New Revision: 356643<br>
> <br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=356643&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=356643&view=rev</a><br>
> Log:<br>
> [Reproducers] Properly handle QEnvironment packets<br>
> <br>
> On Linux, a QEnvironment packet is sent for every environment variable.<br>
> This breaks replay when the number of environment variables is different<br>
> then during capture. The solution is to always reply with OK.<br>
> <br>
> Modified:<br>
>      lldb/trunk/lit/Reproducer/TestGDBRemoteRepro.test<br>
>      lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp<br>
> <br>
> Modified: lldb/trunk/lit/Reproducer/TestGDBRemoteRepro.test<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/TestGDBRemoteRepro.test?rev=356643&r1=356642&r2=356643&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Reproducer/TestGDBRemoteRepro.test?rev=356643&r1=356642&r2=356643&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/lit/Reproducer/TestGDBRemoteRepro.test (original)<br>
> +++ lldb/trunk/lit/Reproducer/TestGDBRemoteRepro.test Wed Mar 20 21:08:31 2019<br>
> @@ -9,7 +9,7 @@<br>
>   # RUN: rm -rf %t.repro<br>
>   # RUN: %clang %S/Inputs/simple.c -g -o %t.out<br>
>   # RUN: %lldb -x -b -s %S/Inputs/GDBRemoteCapture.in --capture --capture-path %t.repro %t.out | FileCheck %s --check-prefix CHECK --check-prefix CAPTURE<br>
> -# RUN: %lldb --replay %t.repro | FileCheck %s --check-prefix CHECK --check-prefix REPLAY<br>
> +# RUN: env FOO=BAR %lldb --replay %t.repro | FileCheck %s --check-prefix CHECK --check-prefix REPLAY<br>
>   <br>
>   # CHECK: Breakpoint 1<br>
>   # CHECK: Process {{.*}} stopped<br>
> <br>
> Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp?rev=356643&r1=356642&r2=356643&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp?rev=356643&r1=356642&r2=356643&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp (original)<br>
> +++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp Wed Mar 20 21:08:31 2019<br>
> @@ -107,6 +107,13 @@ GDBRemoteCommunicationReplayServer::GetP<br>
>       m_send_acks = false;<br>
>     }<br>
>   <br>
> +  // A QEnvironment packet is sent for every environment variable. If the<br>
> +  // number of environment variables is different during replay, the replies<br>
> +  // become out of sync.<br>
> +  if (packet.GetStringRef().find("QEnvironment") == 0) {<br>
> +    return SendRawPacketNoLock("$OK#9a", true);<br>
> +  }<br>
> +<br>
>     Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));<br>
>     while (!m_packet_history.empty()) {<br>
>       // Pop last packet from the history.<br>
> @@ -122,6 +129,14 @@ GDBRemoteCommunicationReplayServer::GetP<br>
>                    "GDBRemoteCommunicationReplayServer actual packet: '{}'\n",<br>
>                    packet.GetStringRef());<br>
>         }<br>
> +<br>
> +      // Ignore QEnvironment packets as they're handled earlier.<br>
> +      if (entry.packet.data.find("QEnvironment") == 1) {<br>
> +        assert(m_packet_history.back().type ==<br>
> +               GDBRemoteCommunicationHistory::ePacketTypeRecv);<br>
> +        m_packet_history.pop_back();<br>
> +      }<br>
> +<br>
>         continue;<br>
>       }<br>
>   <br>
> <br>
> <br>
> _______________________________________________<br>
> lldb-commits mailing list<br>
> <a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br>
> <br>
<br>
It sounds like we should have an "environment provider" which captures <br>
and reinstates the environment during record and replay respectively.<br>
</blockquote></div>