Skip to content

Commit f631e37

Browse files
committed
[DLCov] Origin-Tracking: Add CMake options
1 parent 44a7ecd commit f631e37

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

llvm/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,8 +569,8 @@ endif()
569569
option(LLVM_ENABLE_CRASH_DUMPS "Turn on memory dumps on crashes. Currently only implemented on Windows." OFF)
570570

571571
set(LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING "DISABLED" CACHE STRING
572-
"Enhance Debugify's line number coverage tracking; enabling this is ABI-breaking. Can be DISABLED, or COVERAGE.")
573-
set_property(CACHE LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING PROPERTY STRINGS DISABLED COVERAGE)
572+
"Enhance Debugify's line number coverage tracking; enabling this is ABI-breaking. Can be DISABLED, COVERAGE, or COVERAGE_AND_ORIGIN.")
573+
set_property(CACHE LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING PROPERTY STRINGS DISABLED COVERAGE COVERAGE_AND_ORIGIN)
574574

575575
option(LLVM_EXPERIMENTAL_KEY_INSTRUCTIONS
576576
"Add additional fields to DILocations to support Key Instructions" OFF)

llvm/cmake/modules/HandleLLVMOptions.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ string(TOUPPER "${LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING}" uppercase_LLVM_ENABLE
200200

201201
if( uppercase_LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING STREQUAL "COVERAGE" )
202202
set( LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING 1 )
203+
elseif( uppercase_LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING STREQUAL "COVERAGE_AND_ORIGIN" )
204+
set( LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING 1 )
205+
set( LLVM_ENABLE_DEBUGLOC_ORIGIN_TRACKING 1 )
203206
elseif( uppercase_LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING STREQUAL "DISABLED" OR NOT DEFINED LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING )
204207
# The DISABLED setting is default and requires no additional defines.
205208
else()

llvm/docs/CMake.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,14 @@ enabled sub-projects. Nearly all of these variable names begin with
482482
**LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING**:STRING
483483
Enhances Debugify's ability to detect line number errors by storing extra
484484
information inside Instructions, removing false positives from Debugify's
485-
results at the cost of performance. Allowed values are `DISABLED` (default)
486-
and `COVERAGE`. `COVERAGE` tracks whether and why a line number was
487-
intentionally dropped or not generated for an instruction, allowing Debugify
488-
to avoid reporting these as errors; this comes with a small performance cost
489-
of ~0.1%. `COVERAGE` is an ABI-breaking option.
485+
results at the cost of performance. Allowed values are `DISABLED` (default),
486+
`COVERAGE`, and `COVERAGE_AND_ORIGIN`. `COVERAGE` tracks whether and why a
487+
line number was intentionally dropped or not generated for an instruction,
488+
allowing Debugify to avoid reporting these as errors; this comes with a small
489+
performance cost of ~0.1%. `COVERAGE_AND_ORIGIN` additionally stores a
490+
stacktrace of the point where each DebugLoc is unintentionally dropped,
491+
allowing for much easier bug triaging at the cost of a ~10x performance
492+
slowdown. `COVERAGE` and `COVERAGE_AND_ORIGIN` are ABI-breaking options.
490493

491494
**LLVM_ENABLE_DIA_SDK**:BOOL
492495
Enable building with MSVC DIA SDK for PDB debugging support. Available

llvm/include/llvm/Config/config.h.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@
1919
/* Define to 1 to enable crash memory dumps, and to 0 otherwise. */
2020
#cmakedefine01 LLVM_ENABLE_CRASH_DUMPS
2121

22+
/* Define to 1 to enable expensive checks for debug location coverage checking,
23+
and to 0 otherwise. */
24+
#cmakedefine01 ENABLE_DEBUGLOC_COVERAGE_TRACKING
25+
26+
/* Define to 1 to enable expensive tracking of the origin of debug location
27+
coverage bugs, and to 0 otherwise. */
28+
#cmakedefine01 LLVM_ENABLE_DEBUGLOC_ORIGIN_TRACKING
29+
2230
/* Define to 1 to prefer forward slashes on Windows, and to 0 prefer
2331
backslashes. */
2432
#cmakedefine01 LLVM_WINDOWS_PREFER_FORWARD_SLASH

0 commit comments

Comments
 (0)