build: merge TrackMemory (CURLDEBUG) into debug-enabled option

Drop separate `TrackMemory` (aka `CURLDEBUG`) debug feature.

After recent changes (thread-safety,
193cb00ce9, and updates leading up to
it), `TrackMemory` is unlikely to cause build or runtime issues.

To simplify builds and debug options, enable `TrackMemory`
unconditionally for debug-enabled (aka `DEBUGBUILD`) builds. Before
this patch, this was already the default, with an option to disable
it, or enable it in non-debug-enabled builds.

Note, in practice these two debug options already went hand in hand. It
was not possible to toggle them separately for a long time due to bugs,
before 59dc9f7e69 (2024-05-28) fixed it.

This patch also removes/deprecates separate knobs and feature flags for
`TrackMemory`:
- autotools: `--enable-curldebug`/`--disable-curldebug`
- cmake: `-DENABLE_CURLDEBUG=ON`/`OFF`
- C macro: `CURLDEBUG`
- libcurl: `CURL_VERSION_CURLDEBUG` symbol deprecated in favor
  of `CURL_VERSION_DEBUG`. They always return the same value after this
  patch.

Also:
- drop `TrackMemory` from `curl -V` output.
- rename internal `CURLDEBUG` macro to `CURL_MEMDEBUG` internally.
  To avoid confusion with `DEBUGBUILD`, but to keep guarding
  `TrackMemory`-related internals for readability.
- runtests: bind `TrackMemory` to debug feature. Keep it a separate
  test feature requirement, for clarity.
- CI: drop test builds for combinations of the two options.
- GHA/linux: no longer disable TrackMemory in the TSAN job.

Ref: https://github.com/curl/curl/pull/20328#issuecomment-3754528407

Closes #20331
This commit is contained in:
Viktor Szakats 2026-01-15 14:04:05 +01:00
parent 0002184015
commit 2d5a063121
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
35 changed files with 58 additions and 146 deletions

View file

@ -253,15 +253,11 @@ option(ENABLE_DEBUG "Enable curl debug features (for developing curl itself)" OF
if(ENABLE_DEBUG)
message(WARNING "This curl build is Debug-enabled and insecure, do not use in production.")
endif()
option(ENABLE_CURLDEBUG "Enable TrackMemory debug feature" ${ENABLE_DEBUG})
set(CURL_DEBUG_MACROS "")
if(ENABLE_DEBUG)
list(APPEND CURL_DEBUG_MACROS "DEBUGBUILD")
endif()
if(ENABLE_CURLDEBUG)
list(APPEND CURL_DEBUG_MACROS "CURLDEBUG")
endif()
option(CURL_CLANG_TIDY "Run the build through clang-tidy" OFF)
if(CURL_CLANG_TIDY)
@ -1260,10 +1256,10 @@ if(CURL_USE_GSSAPI)
endif()
# libbacktrace
option(CURL_USE_LIBBACKTRACE "Use libbacktrace. Requires build with TrackMemory and DWARF debug information." OFF)
option(CURL_USE_LIBBACKTRACE "Use libbacktrace. Requires debug-enabled build and DWARF debug information." OFF)
if(CURL_USE_LIBBACKTRACE)
if(NOT ENABLE_CURLDEBUG)
message(FATAL_ERROR "libbacktrace requires TrackMemory enabled")
if(NOT ENABLE_DEBUG)
message(FATAL_ERROR "libbacktrace requires debug-enabled build for TrackMemory")
endif()
if(NOT CMAKE_BUILD_TYPE MATCHES "(Debug|RelWithDebInfo)")
message(FATAL_ERROR "libbacktrace requires debug information")
@ -1981,7 +1977,6 @@ curl_add_if("HTTPS-proxy" NOT CURL_DISABLE_PROXY AND _ssl_enabled AND (USE_OPE
curl_add_if("Unicode" ENABLE_UNICODE)
curl_add_if("threadsafe" HAVE_ATOMIC OR (USE_THREADS_POSIX AND HAVE_PTHREAD_H) OR WIN32)
curl_add_if("Debug" ENABLE_DEBUG)
curl_add_if("TrackMemory" ENABLE_CURLDEBUG)
curl_add_if("ECH" _ssl_enabled AND HAVE_ECH)
curl_add_if("HTTPSRR" _ssl_enabled AND USE_HTTPSRR)
curl_add_if("PSL" USE_LIBPSL)