Author: benm
Date: 2005-03-08 22:45:04 -0500 (Tue, 08 Mar 2005)
New Revision: 41582
Added:
trunk/mcs/tools/valgrind-monofunc.pl
Modified:
trunk/mcs/tools/ChangeLog
Log:
2005-03-08 Ben Maurer <[EMAIL PROTECTED]>
* valgrind-monofunc.pl: Add this wonderful script from Nat.
Modified: trunk/mcs/tools/ChangeLog
===================================================================
--- trunk/mcs/tools/ChangeLog 2005-03-09 02:21:03 UTC (rev 41581)
+++ trunk/mcs/tools/ChangeLog 2005-03-09 03:45:04 UTC (rev 41582)
@@ -1,3 +1,7 @@
+2005-03-08 Ben Maurer <[EMAIL PROTECTED]>
+
+ * valgrind-monofunc.pl: Add this wonderful script from Nat.
+
2005-02-12 Cesar Lopez Nataren <[EMAIL PROTECTED]>
* Makefile: added mjs
Added: trunk/mcs/tools/valgrind-monofunc.pl
===================================================================
--- trunk/mcs/tools/valgrind-monofunc.pl 2005-03-09 02:21:03 UTC (rev
41581)
+++ trunk/mcs/tools/valgrind-monofunc.pl 2005-03-09 03:45:04 UTC (rev
41582)
@@ -0,0 +1,76 @@
+#!/usr/bin/perl
+#
+# Make Valgrind output for Mono applications readable.
+#
+# 8 March 2005
+#
+# Nat Friedman <[EMAIL PROTECTED]>
+#
+# Usage:
+# valgrind --leak-check=full mono -v foo.exe > mono-v.out 2> valgrind.out
+# valgrind-monofunc.pl mono-v.out valgrind.out > valgrind-monofunc.out
+#
+
+my $path = $ARGV[0];
+
+if (! open (FILE, $path)) {
+ die ("Could not open $path");
+}
+
+my @map = ();
+my $i = 0;
+while (<FILE>) {
+
+ $_ =~ s,\n,,g;
+ $_ =~ s,\r,,g;
+
+ if ($_ =~ /^Method/) {
+
+ $method = $ip1 = $ip2 = $_;
+
+ $method =~ s,^Method (.*) emitted at.*$,\1,;
+ $ip1 =~ s,^.*emitted at (0x[a-f0-9]*).*$,\1,;
+ $ip2 =~ s,^.*to (0x[a-f0-9]*).*$,\1,g;
+
+ my %entry = ( "method" => $method,
+ "ip1" => $ip1,
+ "ip2" => $ip2 );
+
+ push (@map, \%entry);
+ $i ++;
+ }
+}
+
+print "Loaded $i method VMAs from $path\n";
+
+#foreach my $foo (@map) {
+# print $$foo{"ip1"} . " - " . $$foo{"ip2"} . " " . $$foo{"method"} .
"\n\n";
+#}
+
+my $path2 = $ARGV[1];
+
+if (! open (FILE2, $path2)) {
+ die ("Could not open $path");
+}
+
+while (<FILE2>) {
+ if ($_ =~ /\?\?\?/) {
+ $ip = $_;
+ $ip =~ s,^.*by (0x[A-Fa-f0-9]*): \?\?\?.*$,\1,g;
+ $ip = lc ($ip);
+ $ip =~ s,\n,,g;
+ $ip =~ s,\r,,g;
+
+ my $last = "UNKNOWN";
+ foreach my $m (@map) {
+# print "Comparing $ip to " . $$m{"ip1"} . "(" . $$m{"method"} . ")
...\n";
+ if (hex ($ip) < hex ($$m{"ip1"})) {
+ $_ =~ s,\?\?\?,$last,g;
+ break;
+ }
+ $last = $$m{"method"};
+ }
+ }
+
+ print $_;
+}
Property changes on: trunk/mcs/tools/valgrind-monofunc.pl
___________________________________________________________________
Name: svn:eol-style
+ native
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches