<div dir="ltr"><div>Whenever I debug Clang in VS I like to use this plugin to auto attach to all spawned child processes:</div><div><a href="https://marketplace.visualstudio.com/items?itemName=vsdbgplat.MicrosoftChildProcessDebuggingPowerTool">https://marketplace.visualstudio.com/items?itemName=vsdbgplat.MicrosoftChildProcessDebuggingPowerTool</a></div><div><br></div><div>-Matt<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 14, 2020 at 9:04 AM Shachaf Co via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div>It seems right - the VS debugger doesn't attach to the new process created by the original one. </div><div dir="auto"><br></div><div dir="auto">Invoking `clang -cc1` directly works, and is good enough for my purpose.</div><div dir="auto"><br></div><div dir="auto">Thank you very much!</div><div dir="auto">Shachaf</div><div dir="auto"><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">בתאריך יום ג׳, 14 ביולי 2020, 18:43, מאת Michael Kruse ‏<<a href="mailto:llvm@meinersbur.de" target="_blank">llvm@meinersbur.de</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This would be an issue of the Visual Studio debugger, not of the<br>
program you are debugging.<br>
<br>
Like this is because when you launch clang, you are launching just the<br>
driver which invokes itself as `clang -cc1` (although under some<br>
conditions it invokes itself directly). Visual Studio does not debug<br>
processes the<br>
<br>
To see what happens, I suggest to start debugging using "step into"<br>
(or set a breakpoint in main of driver.cpp) and continue from there.<br>
<br>
Michael<br>
<br>
<br>
Am Di., 14. Juli 2020 um 02:00 Uhr schrieb Shachaf Co via cfe-dev<br>
<<a href="mailto:cfe-dev@lists.llvm.org" rel="noreferrer" target="_blank">cfe-dev@lists.llvm.org</a>>:<br>
><br>
> Hi all,<br>
><br>
> I Built Clang from source using Visual Studio in debug mode, and I'm trying to debug it.<br>
> However, the debugger doesn't break on any breakpoint that I put.<br>
> When I put breakpoints directly using __debugbreak(), clang just crashes with the even though the debugger is attached.<br>
><br>
> (I'm sure that this code flow actually happens, as I added some llvm::errs to prove it)<br>
><br>
> The original Cmake command was:<br>
> cmake.exe -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_IDE=ON -G "Visual Studio 15 2017" -A x64 -Thost=x64 <path_to_llvm><br>
><br>
> Am I doing something wrong?<br>
> Is there some other step that I'm missing?<br>
> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@lists.llvm.org" rel="noreferrer" target="_blank">cfe-dev@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div></div></div>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>