[llvm-dev] Debugging clang with debugger breakpoints ?

David Greene via llvm-dev llvm-dev at lists.llvm.org
Fri Nov 8 08:42:35 PST 2019


Joan Lluch via llvm-dev <llvm-dev at lists.llvm.org> writes:

> Hi All,
>
> I want to understand some parts of ‘clang' by setting debug breakpoints. 
>
> I have successfully done so with “llc” but I found that debugger breakpoints do not work for ‘clang’
>
> The apparent cause is that the clang code is run as a child process
> which is created in the ‘Execute' function of ‘Program.inc'. The
> debugger stops fine at breakpoints set on the main thread, but
> breakpoints do not work for any code that is executed as the child
> process. I am compiling with Xcode in case this makes a difference.

David provided one answer but if your debugger supports it, an easier
way is to set the debugger to follow child processes.  With gdb it would
be "set follow-fork-mode child".

                 -David


More information about the llvm-dev mailing list