mirror of
https://github.com/curl/curl.git
synced 2026-01-26 06:57:57 +00:00
build: merge TrackMemory (CURLDEBUG) into debug-enabled option
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
This commit is contained in:
parent
0002184015
commit
2d5a063121
2
.github/workflows/linux.yml
vendored
2
.github/workflows/linux.yml
vendored
@ -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
|
||||
|
||||
4
.github/workflows/windows.yml
vendored
4
.github/workflows/windows.yml
vendored
@ -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' }
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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}"
|
||||
|
||||
14
appveyor.yml
14
appveyor.yml
@ -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'
|
||||
|
||||
10
configure.ac
10
configure.ac
@ -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([\
|
||||
|
||||
@ -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`
|
||||
|
||||
@ -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.
|
||||
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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.
|
||||
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
/*
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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) && \
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -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__)
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -117,7 +117,7 @@
|
||||
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...
|
||||
|
||||
@ -57,9 +57,6 @@ endif
|
||||
if DEBUGBUILD
|
||||
AM_CPPFLAGS += -DDEBUGBUILD
|
||||
endif
|
||||
if CURLDEBUG
|
||||
AM_CPPFLAGS += -DCURLDEBUG
|
||||
endif
|
||||
|
||||
if USE_UNICODE
|
||||
UNICODEFLAG = -municode
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 },
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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 =
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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"));
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user