0

I'm investigating the Clang codebase with VS2015, and the .sln file is generated by CMake. I've configured the solution to Debug/x64, and I can see the generated .pdb files accompanying with the libs, but I can't break on the lib code that linked to the clang executable.

For example, I set some break points in the clangParse module where the control flow must go through during parsing, but after the AST is printed the debugger didn't stop on the break points in the clangParse module, but only on the break points set in the clang module itself.

For some other manually created solutions with executable and static-libs, I can debug those libs. Not sure why this doesn't work for the CMake generated Clang/LLVM solution.

Any special setting I need to make here?

Jamboree
  • 5,139
  • 2
  • 16
  • 36
  • Could you share the detailed steps to reproduce this issue? Does this project compile successfully if you just run it using “start without debugging(Ctrl+F5)”? If the breakpoint was not hit and the project compiled normally, do you get any helpful messages in the output window? During debugging mode, put the mouse on the breakpoint which was not hit, or click Debug menu->Windows->Modules window, do you get any messages? – Eddie Chen - MSFT Jul 19 '16 at 08:20
  • @Eddie-MSFT Yes I can compile and run it successfully, and I can break on the break points in the clang project but not in other static-linked libs (e.g. clangParse). And I'm quite sure the control flow should go through the break points I set. – Jamboree Jul 19 '16 at 08:44
  • Can you enable the Exception Settings window as this link:https://msdn.microsoft.com/en-us/library/x85tt0dd.aspx. Add a breakpoint to the code line(A) which will call the library, and then debug it using “Step Into(F11)” after it was hit(A), so you could debug the app one step by one step, collect the messages. Please check “Show Disassembly if source is not available” option under TOOLS->Options->Debugging. If still no messages, can you share a simple sample? – Eddie Chen - MSFT Jul 20 '16 at 02:39
  • @Eddie-MSFT Seems like that clang driver calls `CreateProcessW` on itself, and I lost the track there. – Jamboree Jul 20 '16 at 07:39

1 Answers1

2

The problem is that the Clang driver internally spawns a child process of itself on Windows and all the interesting things are done in the child process, so the break points in the libs would never hit because they're in another process.

To solve this, install Microsoft Child Process Debugging Power Tool and enable child process debugging, this would attach the child process to the debugger.

Jamboree
  • 5,139
  • 2
  • 16
  • 36