Skip to content

Commit 155a737

Browse files
SLTozertomtor
authored andcommitted
[DLCov] Origin-Tracking: Add config options (llvm#143590)
This patch is part of a series that adds origin-tracking to the debugify source location coverage checks, allowing us to report symbolized stack traces of the point where missing source locations appear. This patch adds the configuration options needed to enable this feature, in the form of a new CMake option that enables a flag in `llvm-config.h`; this is not an entirely new CMake flag, but a new option, `COVERAGE_AND_ORIGIN`, for the existing flag `LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING`. This patch contains documentation, but no actual implementation for the flag itself.
1 parent a16b138 commit 155a737

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-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/llvm-config.h.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,8 @@
133133
and to 0 otherwise. */
134134
#cmakedefine01 LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING
135135

136+
/* Define to 1 to enable expensive tracking of the origin of debug location
137+
coverage bugs, and to 0 otherwise. */
138+
#cmakedefine01 LLVM_ENABLE_DEBUGLOC_ORIGIN_TRACKING
139+
136140
#endif

0 commit comments

Comments
 (0)