[Lldb-commits] [PATCH] D119548: [lldb] Fix race condition between lldb-vscode and stop hooks executor

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 15 09:52:21 PST 2022

jingham added a comment.

In D119548#3321936 <https://reviews.llvm.org/D119548#3321936>, @labath wrote:

> In D119548#3321397 <https://reviews.llvm.org/D119548#3321397>, @ilya-nozhkin wrote:
>> In D119548#3321357 <https://reviews.llvm.org/D119548#3321357>, @jingham wrote:
>>> SBTarget.Launch calls Target::Launch.  That sets up a hijacker for the "stop at the first instruction" event regardless of the Sync mode.
>> The problem that it sets up this hijacker too late.
> Yes, so maybe the fix is to set the hijacker early (?)
> That is what happens in the linux case -- hijacking is set up in PlatformPOSIX::DebugProcess, before the process is launched. If windows does not do that, then that would explain the bug and the differences between the platforms.

Ah, I see.  I was focusing on the second event, not the original stop one.

The current code is relying on getting the ProcessSP & calling HijackProcessEvents on it, but as you say, that's too late.  Instead, we should put a Listener in the ProcessLaunchInfo before we do any of the CreateProcess stuff.  All the calls to actually make the process in Target::Launch take a ProcessLaunchInfo, and should obey its listener.  So that seems the right way to ensure that the process events get captured for this initial stop before they get a chance to leak out.



More information about the lldb-commits mailing list