diff options
author | Daniel Stenberg <daniel@haxx.se> | 2003-01-09 11:26:57 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2003-01-09 11:26:57 +0000 |
commit | ba25cad6e2d218c40e33bc1165362378f84471ab (patch) | |
tree | 6428f6eda9404483c75ca38c0ecc50b34fc847d2 /tests/memanalyze.pl | |
parent | abb01123cbd58dda279230ab95f7e817ae0c5a57 (diff) | |
download | curl-ba25cad6e2d218c40e33bc1165362378f84471ab.tar.gz |
pass a file name to memanalyze to read from instead of using stdin
Diffstat (limited to 'tests/memanalyze.pl')
-rwxr-xr-x | tests/memanalyze.pl | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/tests/memanalyze.pl b/tests/memanalyze.pl index 71fc1fde1..c354a5687 100755 --- a/tests/memanalyze.pl +++ b/tests/memanalyze.pl @@ -6,14 +6,17 @@ # MEM mprintf.c:1103 realloc(e5718, 64) = e6118 # MEM sendf.c:232 free(f6520) -do { +while(1) { if($ARGV[0] eq "-v") { $verbose=1; + shift @ARGV; } elsif($ARGV[0] eq "-t") { $trace=1; + shift @ARGV; } -} while (shift @ARGV); + last; +} my $maxmem; @@ -26,7 +29,19 @@ sub newtotal { } } -while(<STDIN>) { +my $file = $ARGV[0]; + +if(! -f $file) { + print "Usage: memanalyze.pl [options] <dump file>\n", + "Options:\n", + " -v Verbose\n", + " -t Trace\n"; + exit; +} + +open(FILE, "<$file"); + +while(<FILE>) { chomp $_; $line = $_; @@ -219,6 +234,7 @@ while(<STDIN>) { print "Not recognized prefix line: $line\n"; } } +close(FILE); if($totalmem) { print "Leak detected: memory still allocated: $totalmem bytes\n"; |