Skip to content

Commit 609c84b

Browse files
authored
benchmark: Make building with debug info the default (swiftlang#29669)
1 parent ea1b18f commit 609c84b

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

benchmark/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ option(SWIFT_BENCHMARK_GENERATE_OPT_VIEW
248248
set(SWIFT_BENCHMARK_OPT_VIEWER "" CACHE FILEPATH
249249
"Path to opt-viewer")
250250

251+
option(SWIFT_BENCHMARK_GENERATE_DEBUG_INFO
252+
"Produce debug info for benchmarks"
253+
TRUE)
254+
251255
if(SWIFT_BENCHMARK_OPT_VIEWER)
252256
# If the path to the opt-viewer was specified manually and we have no access
253257
# to the LLVM tree, assume we have the modules for the opt-viewer installed.

benchmark/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ The following build options are available:
6767
* Enable this option to link the benchmark binaries against the target
6868
machine's Swift standard library and runtime installed with the OS.
6969
(default: OFF)
70+
* `-DSWIFT_BENCHMARK_GENERATE_DEBUG_INFO`
71+
* Enable this option to compile benchmark binaries with debug info.
72+
(default: ON)
7073

7174
The following build targets are available:
7275

benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,10 @@ function (swift_benchmark_compile_archopts)
355355
"-target" "${target}"
356356
"-${BENCH_COMPILE_ARCHOPTS_OPT}" ${PAGE_ALIGNMENT_OPTION})
357357

358+
if(SWIFT_BENCHMARK_GENERATE_DEBUG_INFO)
359+
list(APPEND common_options "-g")
360+
endif()
361+
358362
if (is_darwin)
359363
list(APPEND common_options
360364
"-I" "${srcdir}/utils/ObjectiveCTests"
@@ -384,6 +388,10 @@ function (swift_benchmark_compile_archopts)
384388
"-target" "${target}"
385389
"-${driver_opt}")
386390

391+
if(SWIFT_BENCHMARK_GENERATE_DEBUG_INFO)
392+
list(APPEND common_options_driver "-g")
393+
endif()
394+
387395
if (is_darwin)
388396
list(APPEND common_options_driver
389397
"-sdk" "${sdk}"

0 commit comments

Comments
 (0)