PSA: Added lldb module to manage diagnostic breakpoints

This module was committed in r316773, and allows developers to manage a variety of diagnostic breakpoints.

Feedback on syntax, usability, and missing features is welcome.

(lldb) help clangdiag
For more information run ‘help clangdiag’ Expects ‘raw’ input (see ‘help raw-input’.)

Commands for managing clang diagnostic breakpoints

Syntax: clangdiag enable [|]
clangdiag disable
clangdiag diagtool [|reset]

The following subcommands are supported:

enable – Enable clang diagnostic breakpoints.
disable – Disable all clang diagnostic breakpoints.
diagtool – Return, set, or reset diagtool path.

This command sets breakpoints in clang, and clang based tools, that
emit diagnostics. When a diagnostic is emitted, and clangdiag is
enabled, it will use the appropriate diagtool application to determine
the name of the DiagID, and set breakpoints in all locations that
‘diag::name’ appears in the source. Since the new breakpoints are set
after they are encountered, users will need to launch the executable a
second time in order to hit the new breakpoints.

For in-tree builds, the diagtool application, used to map DiagID’s to
names, is found automatically in the same directory as the target
executable. However, out-or-tree builds must use the ‘diagtool’
subcommand to set the appropriate path for diagtool in the clang debug
bin directory. Since this mapping is created at build-time, it’s
important for users to use the same version that was generated when
clang was compiled, or else the id’s won’t match.


  • Substrings can be passed for both and .
  • If is passed, only enable the DiagID(s) for that warning.
  • If is passed, only enable that DiagID.
  • Rerunning enable clears existing breakpoints.
  • diagtool is used in breakpoint callbacks, so it can be changed
    without the need to rerun enable.
  • Adding this to your ~.lldbinit file makes clangdiag available at startup:
    "command script import /path/to/