Set breakpoint at source line

Question: How do you set breakpoint at C/C++ source line in WinDbg?

Answer:

Method#1

  1. Open source code from File - Open source file menu (or Ctrl + O)
  2. Set cursor on the source code line
  3. Hit [F9] or click HAND icon in toolbar

Method#2

Use WinDbg bp command. The following command sets breakpoint on line 10 of main.cpp.

    bp `main.cpp:10`