diff --git a/ares/setup_once.h b/ares/setup_once.h index 99367aaa6..de6c632be 100644 --- a/ares/setup_once.h +++ b/ares/setup_once.h @@ -297,7 +297,7 @@ typedef int sig_atomic_t; * Macro used to include code only in debug builds. */ -#ifdef CURLDEBUG +#ifdef DEBUGBUILD #define DEBUGF(x) x #else #define DEBUGF(x) do { } while (0) @@ -308,7 +308,7 @@ typedef int sig_atomic_t; * Macro used to include assertion code only in debug builds. */ -#if defined(CURLDEBUG) && defined(HAVE_ASSERT_H) +#if defined(DEBUGBUILD) && defined(HAVE_ASSERT_H) #define DEBUGASSERT(x) assert(x) #else #define DEBUGASSERT(x) do { } while (0) diff --git a/docs/libcurl/curl_version_info.3 b/docs/libcurl/curl_version_info.3 index e090e6066..ea4214c1b 100644 --- a/docs/libcurl/curl_version_info.3 +++ b/docs/libcurl/curl_version_info.3 @@ -5,7 +5,7 @@ .\" * | (__| |_| | _ <| |___ .\" * \___|\___/|_| \_\_____| .\" * -.\" * Copyright (C) 1998 - 2006, Daniel Stenberg, , et al. +.\" * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. .\" * .\" * This software is licensed as described in the file COPYING, which .\" * you should have received as part of this distribution. The terms @@ -21,7 +21,7 @@ .\" * $Id$ .\" ************************************************************************** .\" -.TH curl_version_info 3 "2 Nov 2006" "libcurl 7.16.1" "libcurl Manual" +.TH curl_version_info 3 "10 June 2009" "libcurl 7.19.6" "libcurl Manual" .SH NAME curl_version_info - returns run-time libcurl version info .SH SYNOPSIS @@ -105,8 +105,10 @@ supports HTTP NTLM (added in 7.10.6) .IP CURL_VERSION_GSSNEGOTIATE supports HTTP GSS-Negotiate (added in 7.10.6) .IP CURL_VERSION_DEBUG -libcurl was built with extra debug capabilities built-in. This is mainly of -interest for libcurl hackers. (added in 7.10.6) +libcurl was built with debug capabilities (added in 7.10.6) +.IP CURL_VERSION_CURLDEBUG +libcurl was built with memory tracking debug capabilities. This is mainly of +interest for libcurl hackers. (added in 7.19.6) .IP CURL_VERSION_ASYNCHDNS libcurl was built with support for asynchronous name lookups, which allows more exact timeouts (even on Windows) and less blocking when using the multi diff --git a/docs/libcurl/symbols-in-versions b/docs/libcurl/symbols-in-versions index e2db2fa33..1b53eeaf7 100644 --- a/docs/libcurl/symbols-in-versions +++ b/docs/libcurl/symbols-in-versions @@ -425,6 +425,7 @@ CURL_TIMECOND_IFUNMODSINCE 7.9.7 CURL_TIMECOND_LASTMOD 7.9.7 CURL_VERSION_ASYNCHDNS 7.10.7 CURL_VERSION_CONV 7.15.4 +CURL_VERSION_CURLDEBUG 7.19.6 CURL_VERSION_DEBUG 7.10.6 CURL_VERSION_GSSNEGOTIATE 7.10.6 CURL_VERSION_IDN 7.12.0 diff --git a/include/curl/curl.h b/include/curl/curl.h index 05df0f1c9..970c11678 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -1786,8 +1786,8 @@ typedef struct { #define CURL_VERSION_LARGEFILE (1<<9) /* supports files bigger than 2GB */ #define CURL_VERSION_IDN (1<<10) /* International Domain Names support */ #define CURL_VERSION_SSPI (1<<11) /* SSPI is supported */ -#define CURL_VERSION_CONV (1<<12) /* character conversions are - supported */ +#define CURL_VERSION_CONV (1<<12) /* character conversions supported */ +#define CURL_VERSION_CURLDEBUG (1<<13) /* debug memory tracking supported */ /* * NAME curl_version_info() diff --git a/lib/ftp.c b/lib/ftp.c index 0bd07710d..b46402be5 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -727,7 +727,7 @@ CURLcode Curl_GetFTPResponse(ssize_t *nreadp, /* return number of bytes read */ static void state(struct connectdata *conn, ftpstate newstate) { -#if defined(CURLDEBUG) && !defined(CURL_DISABLE_VERBOSE_STRINGS) +#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) /* for debug purposes */ static const char * const names[]={ "STOP", @@ -765,7 +765,7 @@ static void state(struct connectdata *conn, }; #endif struct ftp_conn *ftpc = &conn->proto.ftpc; -#if defined(CURLDEBUG) && !defined(CURL_DISABLE_VERBOSE_STRINGS) +#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) if(ftpc->state != newstate) infof(conn->data, "FTP %p state change from %s to %s\n", ftpc, names[ftpc->state], names[newstate]); diff --git a/lib/hash.c b/lib/hash.c index fed7b9841..6ca7431ce 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -210,7 +210,7 @@ Curl_hash_pick(struct curl_hash *h, void *key, size_t key_len) return NULL; } -#if defined(CURLDEBUG) && defined(AGGRESIVE_TEST) +#if defined(DEBUGBUILD) && defined(AGGRESIVE_TEST) void Curl_hash_apply(curl_hash *h, void *user, void (*cb)(void *user, void *ptr)) diff --git a/lib/multi.c b/lib/multi.c index 75dd0277d..25c8b9a9c 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -197,7 +197,7 @@ static void moveHandleFromSendToRecvPipeline(struct SessionHandle *habdle, static bool isHandleAtHead(struct SessionHandle *handle, struct curl_llist *pipeline); -#ifdef CURLDEBUG +#ifdef DEBUGBUILD static const char * const statename[]={ "INIT", "CONNECT", @@ -221,7 +221,7 @@ static const char * const statename[]={ /* always use this function to change state, to make debugging easier */ static void multistate(struct Curl_one_easy *easy, CURLMstate state) { -#ifdef CURLDEBUG +#ifdef DEBUGBUILD long connectindex = -5000; #endif CURLMstate oldstate = easy->state; @@ -232,7 +232,7 @@ static void multistate(struct Curl_one_easy *easy, CURLMstate state) easy->state = state; -#ifdef CURLDEBUG +#ifdef DEBUGBUILD if(easy->state > CURLM_STATE_CONNECT && easy->state < CURLM_STATE_COMPLETED) connectindex = easy->easy_conn->connectindex; @@ -1117,7 +1117,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, case CURLM_STATE_WAITDO: /* Wait for our turn to DO when we're pipelining requests */ -#ifdef CURLDEBUG +#ifdef DEBUGBUILD infof(easy->easy_handle, "Conn %d send pipe %d inuse %d athead %d\n", easy->easy_conn->connectindex, easy->easy_conn->send_pipe->size, @@ -1253,7 +1253,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, multistate(easy, CURLM_STATE_PERFORM); result = CURLM_CALL_MULTI_PERFORM; } -#ifdef CURLDEBUG +#ifdef DEBUGBUILD else { infof(easy->easy_handle, "Conn %d recv pipe %d inuse %d athead %d\n", easy->easy_conn->connectindex, @@ -2353,7 +2353,7 @@ static void add_closure(struct Curl_multi *multi, } -#ifdef CURLDEBUG +#ifdef DEBUGBUILD void Curl_multi_dump(const struct Curl_multi *multi_handle) { struct Curl_multi *multi=(struct Curl_multi *)multi_handle; diff --git a/lib/multiif.h b/lib/multiif.h index b467d2954..1f7ee662f 100644 --- a/lib/multiif.h +++ b/lib/multiif.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2008, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2009, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -44,11 +44,11 @@ void Curl_multi_handlePipeBreak(struct SessionHandle *data); /* set the bit for the given sock number to make the bitmap for readable */ #define GETSOCK_READSOCK(x) (1 << (x)) -#ifdef CURLDEBUG +#ifdef DEBUGBUILD /* * Curl_multi_dump is not a stable public function, this is only meant to * allow easier tracking of the internal handle's state and what sockets - * they use. Only for research and development CURLDEBUG enabled builds. + * they use. Only for research and development DEBUGBUILD enabled builds. */ void Curl_multi_dump(const struct Curl_multi *multi_handle); #endif diff --git a/lib/netrc.c b/lib/netrc.c index c82b639c9..a543c34e2 100644 --- a/lib/netrc.c +++ b/lib/netrc.c @@ -92,7 +92,7 @@ int Curl_parsenetrc(const char *host, #define NETRC DOT_CHAR "netrc" -#ifdef CURLDEBUG +#ifdef DEBUGBUILD { /* This is a hack to allow testing. * If compiled with --enable-debug and CURL_DEBUG_NETRC is defined, @@ -106,7 +106,7 @@ int Curl_parsenetrc(const char *host, netrc_alloc = TRUE; } } -#endif /* CURLDEBUG */ +#endif /* DEBUGBUILD */ if(!netrcfile) { home = curl_getenv("HOME"); /* portable environment reader */ if(home) { diff --git a/lib/setup_once.h b/lib/setup_once.h index 933d95abb..4c4d3f599 100644 --- a/lib/setup_once.h +++ b/lib/setup_once.h @@ -304,7 +304,7 @@ typedef int sig_atomic_t; * Macro used to include code only in debug builds. */ -#ifdef CURLDEBUG +#ifdef DEBUGBUILD #define DEBUGF(x) x #else #define DEBUGF(x) do { } while (0) @@ -315,7 +315,7 @@ typedef int sig_atomic_t; * Macro used to include assertion code only in debug builds. */ -#if defined(CURLDEBUG) && defined(HAVE_ASSERT_H) +#if defined(DEBUGBUILD) && defined(HAVE_ASSERT_H) #define DEBUGASSERT(x) assert(x) #else #define DEBUGASSERT(x) do { } while (0) diff --git a/lib/splay.c b/lib/splay.c index c855c4c05..8c6d5ad49 100644 --- a/lib/splay.c +++ b/lib/splay.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1997 - 2008, Daniel Stenberg, , et al. + * Copyright (C) 1997 - 2009, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -332,7 +332,7 @@ int Curl_splayremovebyaddr(struct Curl_tree *t, return 0; } -#ifdef CURLDEBUG +#ifdef DEBUGBUILD void Curl_splayprint(struct Curl_tree * t, int d, char output) { diff --git a/lib/splay.h b/lib/splay.h index 4e6a8c16d..442661d76 100644 --- a/lib/splay.h +++ b/lib/splay.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1997 - 2008, Daniel Stenberg, , et al. + * Copyright (C) 1997 - 2009, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -57,7 +57,7 @@ int Curl_splayremovebyaddr(struct Curl_tree *t, ( ((i.tv_usec) < (j.tv_usec)) ? -1 : \ ( ((i.tv_usec) > (j.tv_usec)) ? 1 : 0 )))) -#ifdef CURLDEBUG +#ifdef DEBUGBUILD void Curl_splayprint(struct Curl_tree * t, int d, char output); #else #define Curl_splayprint(x,y,z) diff --git a/lib/ssh.c b/lib/ssh.c index ef7ce4fe0..d6e30ca7f 100644 --- a/lib/ssh.c +++ b/lib/ssh.c @@ -301,7 +301,7 @@ static LIBSSH2_FREE_FUNC(libssh2_free) /* This is the ONLY way to change SSH state! */ static void state(struct connectdata *conn, sshstate nowstate) { -#if defined(CURLDEBUG) && !defined(CURL_DISABLE_VERBOSE_STRINGS) +#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) /* for debug purposes */ static const char * const names[] = { "SSH_STOP", @@ -358,7 +358,7 @@ static void state(struct connectdata *conn, sshstate nowstate) #endif struct ssh_conn *sshc = &conn->proto.sshc; -#if defined(CURLDEBUG) && !defined(CURL_DISABLE_VERBOSE_STRINGS) +#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) if(sshc->state != nowstate) { infof(conn->data, "SFTP %p state change from %s to %s\n", sshc, names[sshc->state], names[nowstate]); diff --git a/lib/transfer.c b/lib/transfer.c index fd5b3889f..1905c69b9 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -386,7 +386,7 @@ static void read_rewind(struct connectdata *conn, conn->read_pos -= thismuch; conn->bits.stream_was_rewound = TRUE; -#ifdef CURLDEBUG +#ifdef DEBUGBUILD { char buf[512 + 1]; size_t show; diff --git a/lib/url.c b/lib/url.c index c17c226be..0337ea867 100644 --- a/lib/url.c +++ b/lib/url.c @@ -380,7 +380,7 @@ CURLcode Curl_close(struct SessionHandle *data) { struct Curl_multi *m = data->multi; -#ifdef CURLDEBUG +#ifdef DEBUGBUILD /* only for debugging, scan through all connections and see if there's a pipe reference still identifying this handle */ @@ -2310,7 +2310,7 @@ CURLcode Curl_disconnect(struct connectdata *conn) return CURLE_OK; } -#if defined(CURLDEBUG) && defined(AGGRESIVE_TEST) +#if defined(DEBUGBUILD) && defined(AGGRESIVE_TEST) /* scan for DNS cache entries still marked as in use */ Curl_hash_apply(data->hostcache, NULL, Curl_scan_cache_used); @@ -2431,7 +2431,7 @@ bool Curl_isPipeliningEnabled(const struct SessionHandle *handle) CURLcode Curl_addHandleToPipeline(struct SessionHandle *data, struct curl_llist *pipeline) { -#ifdef CURLDEBUG +#ifdef DEBUGBUILD if(!IsPipeliningPossible(data)) { /* when not pipelined, there MUST be no handle in the list already */ if(pipeline->head) @@ -2514,7 +2514,7 @@ static void signalPipeClose(struct curl_llist *pipeline) struct curl_llist_element *next = curr->next; struct SessionHandle *data = (struct SessionHandle *) curr->ptr; -#ifdef CURLDEBUG /* debug-only code */ +#ifdef DEBUGBUILD /* debug-only code */ if(data->magic != CURLEASY_MAGIC_NUMBER) { /* MAJOR BADNESS */ infof(data, "signalPipeClose() found BAAD easy handle\n"); @@ -2596,7 +2596,7 @@ ConnectionExists(struct SessionHandle *data, continue; } -#ifdef CURLDEBUG +#ifdef DEBUGBUILD if(pipeLen > MAX_PIPELINE_LENGTH) { infof(data, "BAD! Connection #%ld has too big pipeline!\n", check->connectindex); @@ -2626,7 +2626,7 @@ ConnectionExists(struct SessionHandle *data, get closed. */ infof(data, "Connection #%ld isn't open enough, can't reuse\n", check->connectindex); -#ifdef CURLDEBUG +#ifdef DEBUGBUILD if(check->recv_pipe->size > 0) { infof(data, "BAD! Unconnected #%ld has a non-empty recv pipeline!\n", check->connectindex); diff --git a/lib/version.c b/lib/version.c index 61a3b3287..2bcec0092 100644 --- a/lib/version.c +++ b/lib/version.c @@ -188,9 +188,12 @@ static curl_version_info_data version_info = { #ifdef HAVE_GSSAPI | CURL_VERSION_GSSNEGOTIATE #endif -#ifdef CURLDEBUG +#ifdef DEBUGBUILD | CURL_VERSION_DEBUG #endif +#ifdef CURLDEBUG + | CURL_VERSION_CURLDEBUG +#endif #ifdef USE_ARES | CURL_VERSION_ASYNCHDNS #endif diff --git a/packages/OS400/curl.inc.in b/packages/OS400/curl.inc.in index bec89fb07..cda482733 100644 --- a/packages/OS400/curl.inc.in +++ b/packages/OS400/curl.inc.in @@ -96,6 +96,8 @@ d c X'00000800' d CURL_VERSION_CONV... d c X'00001000' + d CURL_VERSION_CURLDEBUG... + d c X'00002000' * d HTTPPOST_FILENAME... d c X'00000001' diff --git a/src/main.c b/src/main.c index 732293a59..a3665fc86 100644 --- a/src/main.c +++ b/src/main.c @@ -2857,6 +2857,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ static const struct feat feats[] = { {"AsynchDNS", CURL_VERSION_ASYNCHDNS}, {"Debug", CURL_VERSION_DEBUG}, + {"TrackMemory", CURL_VERSION_CURLDEBUG}, {"GSS-Negotiate", CURL_VERSION_GSSNEGOTIATE}, {"IDN", CURL_VERSION_IDN}, {"IPv6", CURL_VERSION_IPV6}, diff --git a/tests/runtests.pl b/tests/runtests.pl index 13575d51f..b65bcebcd 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -152,8 +152,8 @@ my $SOCKSPIDFILE=".socks.pid"; my $perl="perl -I$srcdir"; my $server_response_maxtime=13; -# this gets set if curl is compiled with debugging: -my $curl_debug=0; +my $debug_build=0; # curl built with --enable-debug +my $curl_debug=0; # curl built with --enable-curldebug (memory tracking) my $libtool; # name of the file that the memory debugging creates: @@ -1554,9 +1554,13 @@ sub checksystem { } elsif($_ =~ /^Features: (.*)/i) { $feat = $1; - if($feat =~ /debug/i) { - # debug is a listed "feature", use that knowledge + if($feat =~ /TrackMemory/i) { + # curl was built with --enable-curldebug (memory tracking) $curl_debug = 1; + } + if($feat =~ /debug/i) { + # curl was built with --enable-debug + $debug_build = 1; # set the NETRC debug env $ENV{'CURL_DEBUG_NETRC'} = "$LOGDIR/netrc"; } @@ -1639,7 +1643,7 @@ sub checksystem { } if(!$curl_debug && $torture) { - die "can't run torture tests since curl was not build with debug"; + die "can't run torture tests since curl was not built with curldebug"; } # curl doesn't list cryptographic support separately, so assume it's @@ -1658,7 +1662,8 @@ sub checksystem { logmsg sprintf("* Server SSL: %s\n", $stunnel?"ON":"OFF"); logmsg sprintf("* libcurl SSL: %s\n", $ssl_version?"ON":"OFF"); - logmsg sprintf("* libcurl debug: %s\n", $curl_debug?"ON":"OFF"); + logmsg sprintf("* debug build: %s\n", $debug_build?"ON":"OFF"); + logmsg sprintf("* track memory: %s\n", $curl_debug?"ON":"OFF"); logmsg sprintf("* valgrind: %s\n", $valgrind?"ON":"OFF"); logmsg sprintf("* HTTP IPv6 %s\n", $http_ipv6?"ON":"OFF"); logmsg sprintf("* FTP IPv6 %s\n", $ftp_ipv6?"ON":"OFF"); @@ -1795,7 +1800,7 @@ sub singletest { } } elsif($f eq "netrc_debug") { - if($curl_debug) { + if($debug_build) { next; } }