]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
build: merge TrackMemory (`CURLDEBUG`) into debug-enabled option
authorViktor Szakats <commit@vsz.me>
Thu, 15 Jan 2026 13:04:05 +0000 (14:04 +0100)
committerViktor Szakats <commit@vsz.me>
Mon, 19 Jan 2026 17:43:17 +0000 (18:43 +0100)
Drop separate `TrackMemory` (aka `CURLDEBUG`) debug feature.

After recent changes (thread-safety,
193cb00ce9b47e75d42157c650cc3de3fd96d35d, 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 59dc9f7e69c399102e9ebe3670360ef52706ff23 (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

35 files changed:
.github/workflows/linux.yml
.github/workflows/windows.yml
CMake/CurlSymbolHiding.cmake
CMakeLists.txt
appveyor.sh
appveyor.yml
configure.ac
docs/INSTALL-CMAKE.md
docs/cmdline-opts/version.md
docs/libcurl/curl_version_info.md
docs/libcurl/symbols-in-versions
docs/tests/TEST-SUITE.md
include/curl/curl.h
lib/Makefile.am
lib/curl_addrinfo.c
lib/curl_addrinfo.h
lib/curl_setup.h
lib/curlx/fopen.c
lib/curlx/fopen.h
lib/fake_addrinfo.h
lib/libcurl.rc
lib/memdebug.c
lib/version.c
m4/curl-confopts.m4
projects/OS400/curl.inc.in
src/Makefile.am
src/curl.rc
src/curlinfo.c
src/tool_libinfo.c
src/tool_main.c
tests/libtest/Makefile.am
tests/libtest/first.c
tests/runtests.pl
tests/tunit/Makefile.am
tests/unit/Makefile.am

index 65bba5ea96deda011f535f1ea0af6dcd7f02347f..a5cbd27bb03ecd7cafc8159561addff73e4d4fa1 100644 (file)
@@ -338,7 +338,7 @@ jobs:
             CFLAGS: -fsanitize=thread -g
             LDFLAGS: -fsanitize=thread
             CC: clang
-            generate: -DOPENSSL_ROOT_DIR=/home/runner/openssl -DENABLE_DEBUG=ON -DENABLE_CURLDEBUG=OFF
+            generate: -DOPENSSL_ROOT_DIR=/home/runner/openssl -DENABLE_DEBUG=ON
 
           - name: 'memory-sanitizer'
             install_packages: clang
index 2e1818f8c8480697c6c7a253264c4e81655fab70..8f10faf62f9c731127f08cad5c965b31821b494a 100644 (file)
@@ -200,7 +200,7 @@ jobs:
           - { build: 'cmake'    , sys: 'msys'      , env: 'x86_64'       , tflags: ''          , config: '-DENABLE_DEBUG=ON -DENABLE_THREADED_RESOLVER=OFF', install: 'openssl-devel libssh2-devel', name: 'default' }
           - { build: 'autotools', sys: 'msys'      , env: 'x86_64'       , tflags: ''          , config: '--with-openssl', install: 'openssl-devel libssh2-devel', name: 'default R' }
           # MinGW
-          - { build: 'autotools', sys: 'mingw64'   , env: 'x86_64'       , tflags: 'skiprun'   , config: '--enable-debug --with-openssl --disable-threaded-resolver --disable-curldebug --enable-static --without-zlib', install: 'mingw-w64-x86_64-openssl mingw-w64-x86_64-libssh2', name: 'default' }
+          - { build: 'autotools', sys: 'mingw64'   , env: 'x86_64'       , tflags: 'skiprun'   , config: '--enable-debug --with-openssl --disable-threaded-resolver --enable-static --without-zlib', install: 'mingw-w64-x86_64-openssl mingw-w64-x86_64-libssh2', name: 'default' }
           - { build: 'autotools', sys: 'mingw64'   , env: 'x86_64'       , tflags: ''          , config: '--enable-debug --with-openssl --enable-windows-unicode --enable-ares --enable-static --disable-shared --enable-ca-native', install: 'mingw-w64-x86_64-c-ares mingw-w64-x86_64-openssl mingw-w64-x86_64-nghttp3 mingw-w64-x86_64-libssh2', name: 'c-ares U' }
           - { build: 'cmake'    , sys: 'mingw64'   , env: 'x86_64'       , tflags: '--min=1650', config: '-DENABLE_DEBUG=ON  -DBUILD_SHARED_LIBS=OFF -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON -DENABLE_ARES=ON', install: 'mingw-w64-x86_64-c-ares mingw-w64-x86_64-libssh2', type: 'Debug', name: 'schannel c-ares U' }
           # MinGW torture
@@ -211,7 +211,7 @@ jobs:
           #          Windows. Do not use this component till there is a fix for these.
           # https://github.com/curl/curl-for-win/blob/3951808deb04df9489ee17430f236ed54436f81a/libssh.sh#L6-L8
           - { build: 'cmake'    , sys: 'clang64'   , env: 'clang-x86_64' , tflags: ''          , config: '-DENABLE_DEBUG=ON  -DBUILD_SHARED_LIBS=OFF -DCURL_USE_GNUTLS=ON   -DENABLE_UNICODE=OFF -DUSE_NGTCP2=ON -DCURL_USE_LIBSSH2=OFF -DCURL_USE_LIBSSH=ON', install: 'mingw-w64-clang-x86_64-gnutls mingw-w64-clang-x86_64-nghttp3 mingw-w64-clang-x86_64-ngtcp2 mingw-w64-clang-x86_64-libssh', type: 'Debug', name: 'gnutls libssh' }
-          - { build: 'cmake'    , sys: 'clangarm64', env: 'clang-aarch64', tflags: 'skiprun'   , config: '-DENABLE_DEBUG=OFF -DBUILD_SHARED_LIBS=ON  -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON -DENABLE_CURLDEBUG=ON', install: 'mingw-w64-clang-aarch64-libssh2', type: 'Release', name: 'schannel R TrackMemory', image: 'windows-11-arm' }
+          - { build: 'cmake'    , sys: 'clangarm64', env: 'clang-aarch64', tflags: 'skiprun'   , config: '-DENABLE_DEBUG=OFF -DBUILD_SHARED_LIBS=ON  -DCURL_USE_SCHANNEL=ON -DENABLE_UNICODE=ON', install: 'mingw-w64-clang-aarch64-libssh2', type: 'Release', name: 'schannel R', image: 'windows-11-arm' }
           - { build: 'cmake'    , sys: 'clang64'   , env: 'clang-x86_64' , tflags: 'skiprun'   , config: '-DENABLE_DEBUG=ON  -DBUILD_SHARED_LIBS=OFF -DCURL_USE_OPENSSL=ON  -DENABLE_UNICODE=OFF -DUSE_NGTCP2=ON', install: 'mingw-w64-clang-x86_64-openssl mingw-w64-clang-x86_64-nghttp3 mingw-w64-clang-x86_64-ngtcp2 mingw-w64-clang-x86_64-libssh2', type: 'Release', name: 'openssl', chkprefill: '_chkprefill' }
           - { build: 'cmake'    , sys: 'ucrt64'    , env: 'ucrt-x86_64'  , tflags: 'skiprun'   , config: '-DENABLE_DEBUG=OFF -DBUILD_SHARED_LIBS=ON  -DCURL_USE_OPENSSL=ON', install: 'mingw-w64-ucrt-x86_64-openssl mingw-w64-ucrt-x86_64-libssh2', type: 'Release', test: 'uwp', name: 'schannel' }
           # { build: 'autotools', sys: 'ucrt64'    , env: 'ucrt-x86_64'  , tflags: 'skiprun'   , config: '--without-debug --with-schannel --disable-static', install: 'mingw-w64-ucrt-x86_64-libssh2', type: 'Release', test: 'uwp', name: 'schannel' }
index 2576a1aff36f919ed1e37ce29d43eecbc95b2266..51a2d94de13a3a965db778bb3348f7c19ab0a916 100644 (file)
@@ -24,7 +24,7 @@
 option(CURL_HIDDEN_SYMBOLS "Hide libcurl internal symbols (=hide all symbols that are not officially external)" ON)
 mark_as_advanced(CURL_HIDDEN_SYMBOLS)
 
-if(WIN32 AND (ENABLE_DEBUG OR ENABLE_CURLDEBUG))
+if(WIN32 AND ENABLE_DEBUG)
   # We need to export internal debug functions,
   # e.g. curl_easy_perform_ev() or curl_dbg_*(),
   # so disable symbol hiding for debug builds and for memory tracking.
index 2c5ecccb97de27db464c55bc8e1e9749858aa391..c5bdd99e8d690017d4857c300f51e6af77a51427 100644 (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)
index 26adeb32e149c0f6efb6c05a8ecd36b74fd839b6..a5af2ef3088b1187d31e6bcd564fe57b356b8d7b 100644 (file)
@@ -67,7 +67,6 @@ if [ "${BUILD_SYSTEM}" = 'CMake' ]; then
     [[ "${TARGET}" = *'ARM64'* ]] && SKIP_RUN='ARM64 architecture'
     [ -n "${TOOLSET:-}" ] && options+=" -T ${TOOLSET}"
     [ "${OPENSSL}" = 'ON' ] && options+=" -DOPENSSL_ROOT_DIR=${openssl_root_win}"
-    [ -n "${CURLDEBUG:-}" ] && options+=" -DENABLE_CURLDEBUG=${CURLDEBUG}"
     if [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2013' ]; then
       mkdir "_bld${_chkprefill}"
       cd "_bld${_chkprefill}"
index b814c5c6a89adbd2159de3accb8afecfcafee6bd..a0e21b2e1ea2ac7e5a8111f3006366f704f71507 100644 (file)
@@ -53,14 +53,13 @@ environment:
       PRJ_CFG: Release
       OPENSSL: 'ON'
       SHARED: 'ON'
-    - job_name: 'CM VS2022, Release, arm64, Schannel, Static, Build-tests'
+    - job_name: 'CM VS2022, Release, arm64, Schannel, Static, no-DEBUGBUILD, Build-tests'
       APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022'
       PRJ_GEN: 'Visual Studio 17 2022'
       TARGET: '-A ARM64'
       PRJ_CFG: Release
       SCHANNEL: 'ON'
       DEBUG: 'OFF'
-      CURLDEBUG: 'ON'
     - job_name: 'CM VS2010, Debug, x64, Schannel, Shared, Build-tests & examples'
       APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2013'
       PRJ_GEN: 'Visual Studio 10 2010'
@@ -120,14 +119,7 @@ environment:
       ENABLE_UNICODE: 'ON'
       EXAMPLES: 'ON'
       TOOLSET: 'ClangCl'
-    - job_name: 'CM VS2022, Debug, x64, Schannel, Static, Unicode, Build-tests'
-      APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022'
-      PRJ_GEN: 'Visual Studio 17 2022'
-      TARGET: '-A x64'
-      PRJ_CFG: Debug
-      SCHANNEL: 'ON'
-      ENABLE_UNICODE: 'ON'
-    - job_name: 'CM VS2022, Release, x64, Schannel, Shared, Unicode, DEBUGBUILD, no-CURLDEBUG, Build-tests'
+    - job_name: 'CM VS2022, Release, x64, Schannel, Shared, Unicode, no-DEBUGBUILD, Build-tests'
       APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022'
       PRJ_GEN: 'Visual Studio 17 2022'
       TARGET: '-A x64'
@@ -135,7 +127,7 @@ environment:
       SCHANNEL: 'ON'
       ENABLE_UNICODE: 'ON'
       SHARED: 'ON'
-      CURLDEBUG: 'OFF'
+      DEBUG: 'OFF'
     - job_name: 'CM VS2022, Debug, x64, no SSL, Static, Build-tests'
       APPVEYOR_BUILD_WORKER_IMAGE: 'Visual Studio 2022'
       PRJ_GEN: 'Visual Studio 17 2022'
index 227f1aeb53bda24b786d4551496013f694993601..d4a1b641a8453f82b1c66965a392006c74ff6936 100644 (file)
@@ -48,8 +48,6 @@ AM_CONDITIONAL(DEBUGBUILD, test "$want_debug" = "yes")
 CURL_CHECK_OPTION_OPTIMIZE
 CURL_CHECK_OPTION_WARNINGS
 CURL_CHECK_OPTION_WERROR
-CURL_CHECK_OPTION_CURLDEBUG
-AM_CONDITIONAL(CURLDEBUG, test "$want_curldebug" = "yes")
 CURL_CHECK_OPTION_SYMBOL_HIDING
 CURL_CHECK_OPTION_ARES
 CURL_CHECK_OPTION_RT
@@ -5312,9 +5310,6 @@ fi
 if test "$want_debug" = "yes"; then
   SUPPORT_FEATURES="$SUPPORT_FEATURES Debug"
 fi
-if test "$want_curldebug" = "yes"; then
-  SUPPORT_FEATURES="$SUPPORT_FEATURES TrackMemory"
-fi
 if test -n "$CURL_CA_EMBED"; then
   SUPPORT_FEATURES="$SUPPORT_FEATURES CAcert"
   CURL_CA_EMBED_msg="$CURL_CA_EMBED"
@@ -5453,11 +5448,6 @@ XC_CHECK_BUILD_FLAGS
 SSL_BACKENDS=${ssl_backends}
 AC_SUBST(SSL_BACKENDS)
 
-if test "$want_curldebug_assumed" = "yes" &&
-   test "$want_curldebug" = "yes" && test "$USE_ARES" = "1"; then
-  ac_configure_args="$ac_configure_args --enable-curldebug"
-fi
-
 CURL_PREPARE_CONFIGUREHELP_PM
 
 AC_CONFIG_FILES([\
index a00a02eb532b52b20dda807fa5821d1402b8ad4e..fb1c6112071b9741d943a2a061f37a5a6c180ac0 100644 (file)
@@ -246,7 +246,6 @@ target_link_libraries(my_target PRIVATE CURL::libcurl)
 - `CURL_STATIC_CRT`:                        Build libcurl with static CRT with MSVC (`/MT`) (requires UCRT, static libcurl or no curl executable). Default: `OFF`
 - `CURL_TARGET_WINDOWS_VERSION`:            Minimum target Windows version as hex string.
 - `CURL_WERROR`:                            Turn compiler warnings into errors. Default: `OFF`
-- `ENABLE_CURLDEBUG`:                       Enable TrackMemory debug feature. Default: =`ENABLE_DEBUG`
 - `ENABLE_CURL_MANUAL`:                     Build the man page for curl and enable its `-M`/`--manual` option. Default: `ON`
 - `ENABLE_DEBUG`:                           Enable curl debug features (for developing curl itself). Default: `OFF`
 - `IMPORT_LIB_SUFFIX`:                      Import library suffix. Default: `_imp` for MSVC-like toolchains, otherwise empty.
@@ -358,7 +357,7 @@ Details via CMake
 - `CURL_USE_GNUTLS`:                        Enable GnuTLS for SSL/TLS. Default: `OFF`
 - `CURL_USE_GSASL`:                         Use libgsasl. Default: `OFF`
 - `CURL_USE_GSSAPI`:                        Use GSSAPI implementation. Default: `OFF`
-- `CURL_USE_LIBBACKTRACE`:                  Use [libbacktrace](https://github.com/ianlancetaylor/libbacktrace). Requires build with TrackMemory and DWARF debug information. Default: `OFF`
+- `CURL_USE_LIBBACKTRACE`:                  Use [libbacktrace](https://github.com/ianlancetaylor/libbacktrace). Requires debug-enabled build and DWARF debug information. Default: `OFF`
 - `CURL_USE_LIBPSL`:                        Use libpsl. Default: `ON`
 - `CURL_USE_LIBSSH2`:                       Use libssh2. Default: `ON`
 - `CURL_USE_LIBSSH`:                        Use libssh. Default: `OFF`
index a6c83ba5fdd954cc2924fe420677165428d9c89a..35e9cf237af61c51683615b9214f1fe17062b140 100644 (file)
@@ -124,9 +124,6 @@ SSPI is supported.
 ## `TLS-SRP`
 SRP (Secure Remote Password) authentication is supported for TLS.
 
-## `TrackMemory`
-Debug memory tracking is supported.
-
 ## `Unicode`
 Unicode support on Windows.
 
index 98b9f2bc783e813e90a2058a0c6aef1a5879520f..20e84fbd736518e074a900855199352ac9227f43 100644 (file)
@@ -356,13 +356,6 @@ curl initialization. (Added in 7.84.0) See libcurl-thread(3)
 libcurl was built with support for TLS-SRP (in one or more of the built-in TLS
 backends).
 
-## `TrackMemory`
-
-*features* mask bit: CURL_VERSION_CURLDEBUG
-
-libcurl was built with memory tracking debug capabilities. This is mainly of
-interest for libcurl hackers.
-
 ## `Unicode`
 
 *features* mask bit: CURL_VERSION_UNICODE
@@ -391,6 +384,14 @@ callbacks. Always 0 since 7.82.0. Deprecated.
 
 ## no name
 
+*features* mask bit: CURL_VERSION_CURLDEBUG
+
+libcurl was built with memory tracking debug capabilities. This is mainly of
+interest for libcurl hackers. Always the same as CURL_VERSION_DEBUG since
+8.19.0. Deprecated.
+
+## no name
+
 *features* mask bit: CURL_VERSION_GSSNEGOTIATE
 
 supports HTTP GSS-Negotiate. Deprecated.
index 1859fe184a8c4aa4b7df5abc582f0fde9d5127ef..d88d45504afa1dec5b814fce8f0dde0fed56c4b1 100644 (file)
@@ -161,7 +161,7 @@ CURL_VERSION_ASYNCHDNS          7.10.7
 CURL_VERSION_BITS               7.43.0
 CURL_VERSION_BROTLI             7.57.0
 CURL_VERSION_CONV               7.15.4
-CURL_VERSION_CURLDEBUG          7.19.6
+CURL_VERSION_CURLDEBUG          7.19.6        8.19.0
 CURL_VERSION_DEBUG              7.10.6
 CURL_VERSION_GSASL              7.76.0
 CURL_VERSION_GSSAPI             7.38.0
index 6a2e60c81759a3f8e6fc11766b9da02525292f08..17a0f8d676c6d539ce541f9423b935dcecfa4108 100644 (file)
@@ -175,7 +175,7 @@ SPDX-License-Identifier: curl
 ### Memory test
 
   The test script checks that all allocated memory is freed properly IF curl
-  has been built with the `CURLDEBUG` define set. The script automatically
+  has been built with the `DEBUGBUILD` define set. The script automatically
   detects if that is the case, and it uses the `memanalyze.pl` script to
   analyze the memory debugging output.
 
index 007db544238450a0e78f617cc17c595c024540aa..87b6344ea6fbe1c35a4b3bfa4bca0ca545b56ee0 100644 (file)
@@ -3184,7 +3184,8 @@ typedef struct curl_version_info_data curl_version_info_data;
                                              supported */
 #define CURL_VERSION_SSPI         (1<<11) /* Built against Windows SSPI */
 #define CURL_VERSION_CONV         (1<<12) /* Character conversions supported */
-#define CURL_VERSION_CURLDEBUG    (1<<13) /* Debug memory tracking supported */
+#define CURL_VERSION_CURLDEBUG    (1<<13) /* Debug memory tracking supported
+                                             (deprecated) */
 #define CURL_VERSION_TLSAUTH_SRP  (1<<14) /* TLS-SRP auth is supported */
 #define CURL_VERSION_NTLM_WB      (1<<15) /* NTLM delegation to winbind helper
                                              is supported */
index adffdb03521ebacc41d77c8fa4ea673e8573027f..3887fd8a26584210c8ca547ac5d6b1a52000504d 100644 (file)
@@ -66,9 +66,6 @@ LIBS = $(BLANK_AT_MAKETIME)
 if DEBUGBUILD
 AM_CPPFLAGS += -DDEBUGBUILD
 endif
-if CURLDEBUG
-AM_CPPFLAGS += -DCURLDEBUG
-endif
 AM_CPPFLAGS += -DBUILDING_LIBCURL
 
 if DOING_NATIVE_WINDOWS
index 61c8b1881967bf654d7ecc0d4eae799e8971a3a1..7a1d406bc784d9b551ed9b1de52099976cca12f1 100644 (file)
@@ -485,7 +485,7 @@ struct Curl_addrinfo *Curl_unix2addr(const char *path, bool *longpath,
 }
 #endif
 
-#if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO) &&  \
+#if defined(CURL_MEMDEBUG) && defined(HAVE_GETADDRINFO) &&  \
   defined(HAVE_FREEADDRINFO)
 /*
  * curl_dbg_freeaddrinfo()
@@ -515,9 +515,9 @@ void curl_dbg_freeaddrinfo(struct addrinfo *freethis,
   freeaddrinfo(freethis);
 #endif
 }
-#endif /* CURLDEBUG && HAVE_FREEADDRINFO */
+#endif /* CURL_MEMDEBUG && HAVE_FREEADDRINFO */
 
-#if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO)
+#if defined(CURL_MEMDEBUG) && defined(HAVE_GETADDRINFO)
 /*
  * curl_dbg_getaddrinfo()
  *
@@ -553,7 +553,7 @@ int curl_dbg_getaddrinfo(const char *hostname,
     curl_dbg_log("ADDR %s:%d getaddrinfo() failed\n", source, line);
   return res;
 }
-#endif /* CURLDEBUG && HAVE_GETADDRINFO */
+#endif /* CURL_MEMDEBUG && HAVE_GETADDRINFO */
 
 #if defined(HAVE_GETADDRINFO) && defined(USE_RESOLVE_ON_IPS)
 /*
index dedf1a6dbca5f69854633e7d37575a270f5cbdad..63d3f7a2442c75c48ab232cabb28f92ecf475bd6 100644 (file)
@@ -79,13 +79,13 @@ struct Curl_addrinfo *Curl_unix2addr(const char *path, bool *longpath,
                                      bool abstract);
 #endif
 
-#if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO) && \
+#if defined(CURL_MEMDEBUG) && defined(HAVE_GETADDRINFO) && \
   defined(HAVE_FREEADDRINFO)
 void curl_dbg_freeaddrinfo(struct addrinfo *freethis, int line,
                            const char *source);
 #endif
 
-#if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO)
+#if defined(CURL_MEMDEBUG) && defined(HAVE_GETADDRINFO)
 int curl_dbg_getaddrinfo(const char *hostname, const char *service,
                          const struct addrinfo *hints,
                          struct addrinfo **result, int line,
index 2f3d9a6ba30050cb8999f70c418c5075f5f34dc6..ff991a074bdf1a8d843c12bfc28eb1b15b593555 100644 (file)
@@ -953,7 +953,11 @@ extern curl_calloc_callback Curl_ccalloc;
 
 #include <curl/curl.h> /* for CURL_EXTERN, curl_socket_t, mprintf.h */
 
-#ifdef CURLDEBUG
+#ifdef DEBUGBUILD
+#define CURL_MEMDEBUG
+#endif
+
+#ifdef CURL_MEMDEBUG
 #ifdef __clang__
 #  define ALLOC_FUNC         __attribute__((__malloc__))
 #  if __clang_major__ >= 4
@@ -1049,7 +1053,7 @@ CURL_EXTERN ALLOC_FUNC FILE *curl_dbg_fdopen(int filedes, const char *mode,
   curl_dbg_accept4(sock, addr, len, flags, __LINE__, __FILE__)
 #endif
 
-#else /* !CURLDEBUG */
+#else /* !CURL_MEMDEBUG */
 
 #define sclose(x) CURL_SCLOSE(x)
 #define fake_sclose(x) Curl_nop_stmt
@@ -1065,11 +1069,11 @@ CURL_EXTERN ALLOC_FUNC FILE *curl_dbg_fdopen(int filedes, const char *mode,
 #define CURL_ACCEPT4 accept4
 #endif
 
-#endif /* CURLDEBUG */
+#endif /* CURL_MEMDEBUG */
 
 /* Allocator macros */
 
-#ifdef CURLDEBUG
+#ifdef CURL_MEMDEBUG
 
 #define curlx_strdup(ptr)          curl_dbg_strdup(ptr, __LINE__, __FILE__)
 #define curlx_malloc(size)         curl_dbg_malloc(size, __LINE__, __FILE__)
@@ -1087,7 +1091,7 @@ CURL_EXTERN ALLOC_FUNC FILE *curl_dbg_fdopen(int filedes, const char *mode,
 #endif
 #endif /* _WIN32 */
 
-#else /* !CURLDEBUG */
+#else /* !CURL_MEMDEBUG */
 
 #ifdef BUILDING_LIBCURL
 #define curlx_strdup(ptr)          Curl_cstrdup(ptr)
@@ -1115,7 +1119,7 @@ CURL_EXTERN ALLOC_FUNC FILE *curl_dbg_fdopen(int filedes, const char *mode,
 #endif
 #endif /* _WIN32 */
 
-#endif /* CURLDEBUG */
+#endif /* CURL_MEMDEBUG */
 
 /* Some versions of the Android NDK is missing the declaration */
 #if defined(HAVE_GETPWUID_R) && \
index e9eb6df3b09e40a42a0603d9822653e166f2f0b2..db4acb8ebc78b37cdbe21db860ce148463fa9505 100644 (file)
@@ -45,7 +45,7 @@ int curlx_fseek(void *stream, curl_off_t offset, int whence)
 #include "multibyte.h"
 #include "timeval.h"
 
-#ifdef CURLDEBUG
+#ifdef CURL_MEMDEBUG
 /*
  * Use system allocators to avoid infinite recursion when called by curl's
  * memory tracker memdebug functions.
index 1e260f24353feb1cd03ef6317e368fd4e229a9e8..a395590d8e0fd7d3a1e06a4434e96c4d2cfde7ea 100644 (file)
@@ -61,7 +61,7 @@ int curlx_win32_rename(const char *oldpath, const char *newpath);
 #define curlx_rename                       rename
 #endif
 
-#ifdef CURLDEBUG
+#ifdef CURL_MEMDEBUG
 #define curlx_fopen(file, mode) curl_dbg_fopen(file, mode, __LINE__, __FILE__)
 #define curlx_freopen(file, mode, fh) \
   curl_dbg_freopen(file, mode, fh, __LINE__, __FILE__)
index db701be40aa4601005198d88236b1b5fc395de4b..07d5b6da8cdde69df492b372bed1cc754c139713 100644 (file)
@@ -29,8 +29,8 @@
 #include <ares.h>
 #endif
 
-#if defined(CURLDEBUG) && defined(USE_ARES) && defined(HAVE_GETADDRINFO) && \
-  (ARES_VERSION >= 0x011a00) /* >= 1.26.0 */
+#if defined(CURL_MEMDEBUG) && defined(HAVE_GETADDRINFO) && \
+  defined(USE_ARES) && (ARES_VERSION >= 0x011a00) /* >= 1.26.0 */
 #define USE_FAKE_GETADDRINFO 1
 #endif
 
index 1ceb4691fb8476d2246ffaf50c5ddbeb4ab138d6..81cd8d71b4e45ba2bcf54467445740d929e40c84 100644 (file)
@@ -32,7 +32,7 @@ VS_VERSION_INFO VERSIONINFO
   FILEVERSION     RC_VERSION
   PRODUCTVERSION  RC_VERSION
   FILEFLAGSMASK   VS_FFI_FILEFLAGSMASK
-#if defined(DEBUGBUILD) || defined(UNITTESTS) || defined(CURLDEBUG) || defined(_DEBUG)
+#if defined(DEBUGBUILD) || defined(UNITTESTS) || defined(_DEBUG)
   FILEFLAGS VS_FF_DEBUG
 #else
   FILEFLAGS 0L
index 19f69805e1d9d9f2a50f9e310105f144c57dd17c..2851bcefa9c6e63ffa7a44695ae7dc2752bf255f 100644 (file)
@@ -23,7 +23,7 @@
  ***************************************************************************/
 #include "curl_setup.h"
 
-#ifdef CURLDEBUG
+#ifdef CURL_MEMDEBUG
 
 #include <stddef.h>  /* for offsetof() */
 
@@ -575,4 +575,4 @@ void curl_dbg_log(const char *format, ...)
   curl_dbg_unlock(was_locked);
 }
 
-#endif /* CURLDEBUG */
+#endif /* CURL_MEMDEBUG */
index 1fb94bb9fc072ed4768d9022ea41b108c4efc8b8..6949278f47d31d540ba01f5471e4dbff0b8eab3b 100644 (file)
@@ -541,9 +541,6 @@ static const struct feat features_table[] = {
 #ifdef USE_TLS_SRP
   FEATURE("TLS-SRP",     NULL,                CURL_VERSION_TLSAUTH_SRP),
 #endif
-#ifdef CURLDEBUG
-  FEATURE("TrackMemory", NULL,                CURL_VERSION_CURLDEBUG),
-#endif
 #if defined(_WIN32) && defined(UNICODE) && defined(_UNICODE)
   FEATURE("Unicode",     NULL,                CURL_VERSION_UNICODE),
 #endif
@@ -690,6 +687,10 @@ curl_version_info_data *curl_version_info(CURLversion stamp)
       feature_names[n++] = p->name;
     }
 
+#ifdef DEBUGBUILD
+  features |= CURL_VERSION_CURLDEBUG; /* for compatibility */
+#endif
+
   feature_names[n] = NULL;  /* Terminate array. */
   version_info.features = features;
 
index edcd103fba4fbaab4fec52dbf58f37f2ee23431c..c1da6b8c0f2a3a7cdbd0fca59713f22a708d60e8 100644 (file)
@@ -101,56 +101,6 @@ AS_HELP_STRING([--disable-ares],[Disable c-ares for DNS lookups]),
 ])
 
 
-dnl CURL_CHECK_OPTION_CURLDEBUG
-dnl -------------------------------------------------
-dnl Verify if configure has been invoked with option
-dnl --enable-curldebug or --disable-curldebug, and set
-dnl shell variable want_curldebug value as appropriate.
-
-AC_DEFUN([CURL_CHECK_OPTION_CURLDEBUG], [
-  AC_MSG_CHECKING([whether to enable curl debug memory tracking])
-  OPT_CURLDEBUG_BUILD="default"
-  AC_ARG_ENABLE(curldebug,
-AS_HELP_STRING([--enable-curldebug],[Enable curl debug memory tracking])
-AS_HELP_STRING([--disable-curldebug],[Disable curl debug memory tracking]),
-  OPT_CURLDEBUG_BUILD=$enableval)
-  case "$OPT_CURLDEBUG_BUILD" in
-    no)
-      dnl --disable-curldebug option used
-      want_curldebug="no"
-      AC_MSG_RESULT([no])
-      ;;
-    default)
-      dnl configure's curldebug option not specified. Initially we will
-      dnl handle this as a request to use the same setting as option
-      dnl --enable-debug. IOW, initially, for debug-enabled builds
-      dnl this will be handled as a request to enable curldebug if
-      dnl possible, and for debug-disabled builds this will be handled
-      dnl as a request to disable curldebug.
-      if test "$want_debug" = "yes"; then
-        AC_MSG_RESULT([(assumed) yes])
-      else
-        AC_MSG_RESULT([no])
-      fi
-      want_curldebug_assumed="yes"
-      want_curldebug="$want_debug"
-      ;;
-    *)
-      dnl --enable-curldebug option used.
-      dnl The use of this option value is a request to enable curl's
-      dnl debug memory tracking for the libcurl library. This can only
-      dnl be done when some requisites are simultaneously satisfied.
-      dnl Later on, these requisites are verified and if they are not
-      dnl fully satisfied the option will be ignored and act as if
-      dnl --disable-curldebug had been given setting shell variable
-      dnl want_curldebug to 'no'.
-      want_curldebug="yes"
-      AC_MSG_RESULT([yes])
-      ;;
-  esac
-])
-
-
 dnl CURL_CHECK_OPTION_DEBUG
 dnl -------------------------------------------------
 dnl Verify if configure has been invoked with option
@@ -159,7 +109,6 @@ dnl variable want_debug value as appropriate.
 
 AC_DEFUN([CURL_CHECK_OPTION_DEBUG], [
   AC_BEFORE([$0],[CURL_CHECK_OPTION_WARNINGS])dnl
-  AC_BEFORE([$0],[CURL_CHECK_OPTION_CURLDEBUG])dnl
   AC_BEFORE([$0],[XC_CHECK_PROG_CC])dnl
   AC_MSG_CHECKING([whether to enable debug build options])
   OPT_DEBUG_BUILD="default"
index 1fe5b07ebeef95408d656dc98de7118bcaf0819c..de3d96c3ac05158c8837ba65fa75b8e8638f27c9 100644 (file)
      d CURL_VERSION_CONV...
      d                 c                   X'00001000'
      d CURL_VERSION_CURLDEBUG...
-     d                 c                   X'00002000'
+     d                 c                   X'00002000'                          Deprecated
      d CURL_VERSION_TLSAUTH_SRP...
      d                 c                   X'00004000'
      d CURL_VERSION_NTLM_WB...
index 49dc6693ccb035ba2ee4eca276f5fdf8e6524864..50d282f651e43bcce2fed7e88506888f24dfe2cb 100644 (file)
@@ -57,9 +57,6 @@ endif
 if DEBUGBUILD
 AM_CPPFLAGS += -DDEBUGBUILD
 endif
-if CURLDEBUG
-AM_CPPFLAGS += -DCURLDEBUG
-endif
 
 if USE_UNICODE
 UNICODEFLAG = -municode
index 389b483b4b99a88bc4911d744d30dd0181aa7cc0..3c5c8709d51a727a21825945ab5504e8919ea795 100644 (file)
@@ -32,7 +32,7 @@ VS_VERSION_INFO VERSIONINFO
   FILEVERSION     RC_VERSION
   PRODUCTVERSION  RC_VERSION
   FILEFLAGSMASK   VS_FFI_FILEFLAGSMASK
-#if defined(DEBUGBUILD) || defined(UNITTESTS) || defined(CURLDEBUG) || defined(_DEBUG)
+#if defined(DEBUGBUILD) || defined(UNITTESTS) || defined(_DEBUG)
   FILEFLAGS VS_FF_DEBUG
 #else
   FILEFLAGS 0L
index 3be2d8206d2e8c8430bc059dc149fc3541074d77..b5626232e3ddcdbab835ea8a74e11d2fb96cc0ce 100644 (file)
@@ -234,7 +234,7 @@ static const char *disabled[] = {
 #endif
   ,
   "override-dns: "
-#if defined(CURLDEBUG) &&                                       \
+#if defined(CURL_MEMDEBUG) &&                              \
   (defined(CURLRES_ARES) || defined(USE_FAKE_GETADDRINFO))
   "ON"
 #else
index 951706e21d02e1b4e5d02595e47aafe71af5128b..634b8c4fe1fdeb080d88f6447b2eabb99fe8ad34 100644 (file)
@@ -114,7 +114,6 @@ static struct feature_name_presentp {
   { "SSLS-EXPORT",    &feature_ssls_export, 0 },
   { "threadsafe",     NULL,                 CURL_VERSION_THREADSAFE },
   { "TLS-SRP",        &feature_tls_srp,     CURL_VERSION_TLSAUTH_SRP },
-  { "TrackMemory",    NULL,                 CURL_VERSION_CURLDEBUG },
   { "Unicode",        NULL,                 CURL_VERSION_UNICODE },
   { "UnixSockets",    NULL,                 CURL_VERSION_UNIX_SOCKETS },
   { "zstd",           &feature_zstd,        CURL_VERSION_ZSTD },
index 2cb3fd647ce04c109e8afc58da002bdeddbf3b8a..806fbd4c0e575debf859be531b343c39c96aebe7 100644 (file)
@@ -98,7 +98,7 @@ static int main_checkfds(void)
 #define main_checkfds() 0
 #endif
 
-#ifdef CURLDEBUG
+#ifdef CURL_MEMDEBUG
 static void memory_tracking_init(void)
 {
   char *env;
index 7b99ba68e7a60b4172a00596e282188cb7618861..e174698a32d0cde45492bba437cd35c594651755 100644 (file)
@@ -57,9 +57,6 @@ endif
 if DEBUGBUILD
 AM_CPPFLAGS += -DDEBUGBUILD
 endif
-if CURLDEBUG
-AM_CPPFLAGS += -DCURLDEBUG
-endif
 
 if USE_CPPFLAG_CURL_STATICLIB
 curlx_c_lib =
index dd26a146a423ccceea08c14cb41e7d2c13ab4735..0a5ee2047f2fe6bc8d7f9cb0cf4cb253f523d23a 100644 (file)
@@ -122,7 +122,7 @@ int cgetopt(int argc, const char * const argv[], const char *optstring)
   }
 }
 
-#ifdef CURLDEBUG
+#ifdef CURL_MEMDEBUG
 static void memory_tracking_init(void)
 {
   const char *env;
index e8297137c1e4a4e2da1395daac8c1e2242a5a2ad..010acb086e213f166004767113b3a28b982832a1 100755 (executable)
@@ -656,8 +656,8 @@ sub checksystemfeatures {
         elsif($_ =~ /^Features: (.*)/i) {
             $feat = $1;
 
-            # built with memory tracking support (--enable-curldebug); may be disabled later
-            $feature{"TrackMemory"} = $feat =~ /TrackMemory/i;
+            # built with memory tracking support (--enable-debug); may be disabled later
+            $feature{"TrackMemory"} = $feat =~ /Debug/i;
             # curl was built with --enable-debug
             $feature{"Debug"} = $feat =~ /Debug/i;
             # ssl enabled
@@ -846,7 +846,7 @@ sub checksystemfeatures {
 
     if($torture && !$feature{"TrackMemory"}) {
         die "cannot run torture tests since curl was built without ".
-            "TrackMemory feature (--enable-curldebug)";
+            "TrackMemory feature (--enable-debug)";
     }
 
     my $hostname=join(' ', runclientoutput("hostname"));
index 219b7a10579c67e173a0856680c453a34eb45699..ac7e31adee388ce6a29b5fa52abd58f52898233c 100644 (file)
@@ -54,9 +54,6 @@ AM_CPPFLAGS += -DCURL_STATICLIB -DUNITTESTS
 if DEBUGBUILD
 AM_CPPFLAGS += -DDEBUGBUILD
 endif
-if CURLDEBUG
-AM_CPPFLAGS += -DCURLDEBUG
-endif
 
 if BUILD_UNITTESTS
 $(BUNDLE).c: $(top_srcdir)/scripts/mk-unity.pl Makefile.inc $(FIRST_C) $(TESTS_C)
index 32c2f3895594b495fa0c2b8f37eccdf56c6f5f03..5c87bf9ae5dece2fd8b418ebf1c4efb0af21d66b 100644 (file)
@@ -53,9 +53,6 @@ AM_CPPFLAGS += -DCURL_STATICLIB -DUNITTESTS
 if DEBUGBUILD
 AM_CPPFLAGS += -DDEBUGBUILD
 endif
-if CURLDEBUG
-AM_CPPFLAGS += -DCURLDEBUG
-endif
 # unit tests are small pretend-libcurl-programs, pass BUILDING_LIBCURL to reflect that
 AM_CPPFLAGS += -DBUILDING_LIBCURL