[cfe-dev] Why clang needs to fork into itself?

Aaron Ballman aaron at aaronballman.com
Tue Jan 28 05:42:17 PST 2014


On Tue, Jan 28, 2014 at 12:17 AM, Yaron Keren <yaron.keren at gmail.com> wrote:
> Hi,
>
> With Visual C++, this structure prevents the debugger from working, since
> the breakpoints are placed on the main process and not the spawned process.
> The cumbersome workaround is to print and capture the child -cc1 command
> line and use it instead.

I work on clang pretty much every day in Windows, and I do not have
difficulties with adding the proper -cc1 flags. It was a bit
surprising at first, but it didn't take long to become used to. If
it's overly onerous, which very rarely happens for me, I'll simply use
WinDbg and set .childdbg to 1
(http://msdn.microsoft.com/en-us/library/windows/hardware/ff562215(v=vs.85).aspx),
then do my debugging. Obviously, everyone debugs differently, so YMMV.

Also, one thing to point out, is that when the child process crashes,
one of the things it prints out is the exact cc1 command line options
used to invoke the process, with everything properly quoted and
command-line ready. So it's a matter of copy/paste to debug when you
have a crashing problem.

~Aaron



More information about the cfe-dev mailing list