[cfe-dev] Debugging Clang with Visual Studio

Matt Asplund via cfe-dev cfe-dev at lists.llvm.org
Tue Jul 14 12:44:39 PDT 2020


Whenever I debug Clang in VS I like to use this plugin to auto attach to
all spawned child processes:
https://marketplace.visualstudio.com/items?itemName=vsdbgplat.MicrosoftChildProcessDebuggingPowerTool

-Matt

On Tue, Jul 14, 2020 at 9:04 AM Shachaf Co via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> It seems right - the VS debugger doesn't attach to the new process created
> by the original one.
>
> Invoking `clang -cc1` directly works, and is good enough for my purpose.
>
> Thank you very much!
> Shachaf
>
> בתאריך יום ג׳, 14 ביולי 2020, 18:43, מאת Michael Kruse ‏<
> llvm at meinersbur.de>:
>
>> This would be an issue of the Visual Studio debugger, not of the
>> program you are debugging.
>>
>> Like this is because when you launch clang, you are launching just the
>> driver which invokes itself as `clang -cc1` (although under some
>> conditions it invokes itself directly). Visual Studio does not debug
>> processes the
>>
>> To see what happens, I suggest to start debugging using "step into"
>> (or set a breakpoint in main of driver.cpp) and continue from there.
>>
>> Michael
>>
>>
>> Am Di., 14. Juli 2020 um 02:00 Uhr schrieb Shachaf Co via cfe-dev
>> <cfe-dev at lists.llvm.org>:
>> >
>> > Hi all,
>> >
>> > I Built Clang from source using Visual Studio in debug mode, and I'm
>> trying to debug it.
>> > However, the debugger doesn't break on any breakpoint that I put.
>> > When I put breakpoints directly using __debugbreak(), clang just
>> crashes with the even though the debugger is attached.
>> >
>> > (I'm sure that this code flow actually happens, as I added some
>> llvm::errs to prove it)
>> >
>> > The original Cmake command was:
>> > 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>
>> >
>> > Am I doing something wrong?
>> > Is there some other step that I'm missing?
>> > _______________________________________________
>> > cfe-dev mailing list
>> > cfe-dev at lists.llvm.org
>> > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200714/898f7a7d/attachment.html>


More information about the cfe-dev mailing list