Skip to content
Snippets Groups Projects
Commit ba25cad6 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

pass a file name to memanalyze to read from instead of using stdin

parent abb01123
No related branches found
No related tags found
No related merge requests found
...@@ -6,14 +6,17 @@ ...@@ -6,14 +6,17 @@
# MEM mprintf.c:1103 realloc(e5718, 64) = e6118 # MEM mprintf.c:1103 realloc(e5718, 64) = e6118
# MEM sendf.c:232 free(f6520) # MEM sendf.c:232 free(f6520)
do { while(1) {
if($ARGV[0] eq "-v") { if($ARGV[0] eq "-v") {
$verbose=1; $verbose=1;
shift @ARGV;
} }
elsif($ARGV[0] eq "-t") { elsif($ARGV[0] eq "-t") {
$trace=1; $trace=1;
shift @ARGV;
} }
} while (shift @ARGV); last;
}
my $maxmem; my $maxmem;
...@@ -26,7 +29,19 @@ sub newtotal { ...@@ -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 $_; chomp $_;
$line = $_; $line = $_;
...@@ -219,6 +234,7 @@ while(<STDIN>) { ...@@ -219,6 +234,7 @@ while(<STDIN>) {
print "Not recognized prefix line: $line\n"; print "Not recognized prefix line: $line\n";
} }
} }
close(FILE);
if($totalmem) { if($totalmem) {
print "Leak detected: memory still allocated: $totalmem bytes\n"; print "Leak detected: memory still allocated: $totalmem bytes\n";
......
...@@ -777,7 +777,7 @@ sub singletest { ...@@ -777,7 +777,7 @@ sub singletest {
print "\n** ALERT! memory debuggin without any output file?\n"; print "\n** ALERT! memory debuggin without any output file?\n";
} }
else { else {
my @memdata=`$memanalyze < $memdump`; my @memdata=`$memanalyze $memdump`;
my $leak=0; my $leak=0;
for(@memdata) { for(@memdata) {
if($_ ne "") { if($_ ne "") {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment