mirror of
https://github.com/curl/curl.git
synced 2026-04-11 12:01:42 +08:00
memdebug: stop tracking send and recv
- they rarely catch any problems - we have other ways to test different send/recv problems - the number of such calls vary much more per invoke than others, making memdebugging harder - reducing the total number of fallible functions per test is good - they were not used as intended anyway Closes #20097
This commit is contained in:
parent
d4b62bff64
commit
a585cc35e5
@ -1003,18 +1003,6 @@ CURL_EXTERN int curl_dbg_socketpair(int domain, int type, int protocol,
|
||||
int line, const char *source);
|
||||
#endif
|
||||
|
||||
/* send/receive sockets */
|
||||
CURL_EXTERN SEND_TYPE_RETV curl_dbg_send(SEND_TYPE_ARG1 sockfd,
|
||||
SEND_QUAL_ARG2 SEND_TYPE_ARG2 buf,
|
||||
SEND_TYPE_ARG3 len,
|
||||
SEND_TYPE_ARG4 flags, int line,
|
||||
const char *source);
|
||||
CURL_EXTERN RECV_TYPE_RETV curl_dbg_recv(RECV_TYPE_ARG1 sockfd,
|
||||
RECV_TYPE_ARG2 buf,
|
||||
RECV_TYPE_ARG3 len,
|
||||
RECV_TYPE_ARG4 flags, int line,
|
||||
const char *source);
|
||||
|
||||
/* FILE functions */
|
||||
CURL_EXTERN int curl_dbg_fclose(FILE *file, int line, const char *source);
|
||||
CURL_EXTERN ALLOC_FUNC FILE *curl_dbg_fopen(const char *file, const char *mode,
|
||||
@ -1045,8 +1033,6 @@ CURL_EXTERN ALLOC_FUNC FILE *curl_dbg_fdopen(int filedes, const char *mode,
|
||||
#define CURL_ACCEPT4(sock, addr, len, flags) \
|
||||
curl_dbg_accept4(sock, addr, len, flags, __LINE__, __FILE__)
|
||||
#endif
|
||||
#define CURL_SEND(a, b, c, d) curl_dbg_send(a, b, c, d, __LINE__, __FILE__)
|
||||
#define CURL_RECV(a, b, c, d) curl_dbg_recv(a, b, c, d, __LINE__, __FILE__)
|
||||
|
||||
#else /* !CURLDEBUG */
|
||||
|
||||
@ -1063,8 +1049,6 @@ CURL_EXTERN ALLOC_FUNC FILE *curl_dbg_fdopen(int filedes, const char *mode,
|
||||
#ifdef HAVE_ACCEPT4
|
||||
#define CURL_ACCEPT4 accept4
|
||||
#endif
|
||||
#define CURL_SEND send
|
||||
#define CURL_RECV recv
|
||||
|
||||
#endif /* CURLDEBUG */
|
||||
|
||||
|
||||
@ -402,37 +402,6 @@ curl_socket_t curl_dbg_socket(int domain, int type, int protocol,
|
||||
return sockfd;
|
||||
}
|
||||
|
||||
SEND_TYPE_RETV curl_dbg_send(SEND_TYPE_ARG1 sockfd,
|
||||
SEND_QUAL_ARG2 SEND_TYPE_ARG2 buf,
|
||||
SEND_TYPE_ARG3 len, SEND_TYPE_ARG4 flags,
|
||||
int line, const char *source)
|
||||
{
|
||||
SEND_TYPE_RETV rc;
|
||||
if(countcheck("send", line, source))
|
||||
return -1;
|
||||
/* !checksrc! disable BANNEDFUNC 1 */
|
||||
rc = send(sockfd, buf, len, flags);
|
||||
if(source)
|
||||
curl_dbg_log("SEND %s:%d send(%lu) = %ld\n",
|
||||
source, line, (unsigned long)len, (long)rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
RECV_TYPE_RETV curl_dbg_recv(RECV_TYPE_ARG1 sockfd, RECV_TYPE_ARG2 buf,
|
||||
RECV_TYPE_ARG3 len, RECV_TYPE_ARG4 flags,
|
||||
int line, const char *source)
|
||||
{
|
||||
RECV_TYPE_RETV rc;
|
||||
if(countcheck("recv", line, source))
|
||||
return -1;
|
||||
/* !checksrc! disable BANNEDFUNC 1 */
|
||||
rc = recv(sockfd, buf, len, flags);
|
||||
if(source)
|
||||
curl_dbg_log("RECV %s:%d recv(%lu) = %ld\n",
|
||||
source, line, (unsigned long)len, (long)rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SOCKETPAIR
|
||||
int curl_dbg_socketpair(int domain, int type, int protocol,
|
||||
curl_socket_t socket_vector[2],
|
||||
|
||||
@ -1332,7 +1332,7 @@ static void reset_socket_fdwrite(curl_socket_t s)
|
||||
int t;
|
||||
int l = (int)sizeof(t);
|
||||
if(!getsockopt(s, SOL_SOCKET, SO_TYPE, (char *)&t, &l) && t == SOCK_STREAM)
|
||||
CURL_SEND(s, NULL, 0, 0);
|
||||
send(s, NULL, 0, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@ -199,8 +199,8 @@ static CURLcode do_sendmsg(struct Curl_cfilter *cf,
|
||||
|
||||
*psent = 0;
|
||||
|
||||
while((rv = CURL_SEND(qctx->sockfd, (const char *)pkt,
|
||||
(SEND_TYPE_ARG3)pktlen, 0)) == -1 &&
|
||||
while((rv = send(qctx->sockfd, (const char *)pkt,
|
||||
(SEND_TYPE_ARG3)pktlen, 0)) == -1 &&
|
||||
SOCKERRNO == SOCKEINTR)
|
||||
;
|
||||
|
||||
|
||||
@ -100,9 +100,7 @@ my %banfunc = (
|
||||
"open" => 1,
|
||||
"printf" => 1,
|
||||
"realloc" => 1,
|
||||
"recv" => 1,
|
||||
"rename" => 1,
|
||||
"send" => 1,
|
||||
"snprintf" => 1,
|
||||
"socket" => 1,
|
||||
"socketpair" => 1,
|
||||
|
||||
@ -120,7 +120,7 @@ size_t tool_read_cb(char *buffer, size_t sz, size_t nmemb, void *userdata)
|
||||
execute */
|
||||
if(per->uploadfile && !strcmp(per->uploadfile, ".") && per->infd > 0) {
|
||||
#if defined(_WIN32) && !defined(CURL_WINDOWS_UWP)
|
||||
rc = CURL_RECV(per->infd, buffer, curlx_uztosi(sz * nmemb), 0);
|
||||
rc = recv(per->infd, buffer, curlx_uztosi(sz * nmemb), 0);
|
||||
if(rc < 0) {
|
||||
if(SOCKERRNO == SOCKEWOULDBLOCK) {
|
||||
errno = 0;
|
||||
|
||||
@ -781,7 +781,7 @@ static DWORD WINAPI win_stdin_thread_func(void *thread_data)
|
||||
break;
|
||||
if(n == 0)
|
||||
break;
|
||||
nwritten = CURL_SEND(socket_w, buffer, n, 0);
|
||||
nwritten = send(socket_w, buffer, n, 0);
|
||||
if(nwritten == SOCKET_ERROR)
|
||||
break;
|
||||
if((DWORD)nwritten != n)
|
||||
|
||||
@ -63,8 +63,6 @@ sub memanalyze {
|
||||
my $reallocs = 0;
|
||||
my $strdups = 0;
|
||||
my $wcsdups = 0;
|
||||
my $sends = 0;
|
||||
my $recvs = 0;
|
||||
my $sockets = 0;
|
||||
|
||||
$memsum = 0; # the total number of memory allocated over the lifetime
|
||||
@ -346,14 +344,6 @@ sub memanalyze {
|
||||
elsif($_ =~ /^GETNAME ([^ ]*):(\d*) (.*)/) {
|
||||
# not much to do
|
||||
}
|
||||
# SEND url.c:1901 send(83) = 83
|
||||
elsif($_ =~ /^SEND ([^ ]*):(\d*) (.*)/) {
|
||||
$sends++;
|
||||
}
|
||||
# RECV url.c:1901 recv(102400) = 256
|
||||
elsif($_ =~ /^RECV ([^ ]*):(\d*) (.*)/) {
|
||||
$recvs++;
|
||||
}
|
||||
|
||||
# ADDR url.c:1282 getaddrinfo() = 0x5ddd
|
||||
elsif($_ =~ /^ADDR ([^ ]*):(\d*) (.*)/) {
|
||||
@ -445,11 +435,9 @@ sub memanalyze {
|
||||
"Strdups: $strdups\n",
|
||||
"Wcsdups: $wcsdups\n",
|
||||
"Frees: $frees\n",
|
||||
"Sends: $sends\n",
|
||||
"Recvs: $recvs\n",
|
||||
"Sockets: $sockets\n",
|
||||
"Allocations: ".($mallocs + $callocs + $reallocs + $strdups + $wcsdups)."\n",
|
||||
"Operations: ".($mallocs + $callocs + $reallocs + $strdups + $wcsdups + $sends + $recvs + $sockets)."\n",
|
||||
"Operations: ".($mallocs + $callocs + $reallocs + $strdups + $wcsdups + $sockets)."\n",
|
||||
"Maximum allocated: $maxmem\n",
|
||||
"Total allocated: $memsum\n";
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user