Author: trow
Date: 2005-10-10 12:51:40 -0400 (Mon, 10 Oct 2005)
New Revision: 51524

Modified:
   trunk/heap-buddy/analyzer/Backtrace.cs
   trunk/heap-buddy/analyzer/OutfileReader.cs
Log:
Fixes for getting backtraces and method names into the right state when we
loaded from a log file.



Modified: trunk/heap-buddy/analyzer/Backtrace.cs
===================================================================
--- trunk/heap-buddy/analyzer/Backtrace.cs      2005-10-10 16:46:15 UTC (rev 
51523)
+++ trunk/heap-buddy/analyzer/Backtrace.cs      2005-10-10 16:51:40 UTC (rev 
51524)
@@ -45,6 +45,7 @@
 
                public uint Code {
                        get { return code; }
+                       set { code = value; }
                }
 
                public Frame [] Frames {

Modified: trunk/heap-buddy/analyzer/OutfileReader.cs
===================================================================
--- trunk/heap-buddy/analyzer/OutfileReader.cs  2005-10-10 16:46:15 UTC (rev 
51523)
+++ trunk/heap-buddy/analyzer/OutfileReader.cs  2005-10-10 16:51:40 UTC (rev 
51524)
@@ -151,9 +151,23 @@
                                File.Copy (tmp_filename, filename, true /* 
allow overwrite */);
                                File.Delete (tmp_filename);
 
-                               // We need to keep around the lazy_reader, 
since the
-                               // GcData is not in memory.
-                               lazy_reader = reader;
+                               // Fix up the method names
+                               for (int i = 0; i < methods.Length; ++i) {
+                                       int j = methods [i].Name.IndexOf (" (");
+                                       methods [i].Arguments = methods 
[i].Name.Substring (j+1);
+                                       methods [i].Name = methods 
[i].Name.Substring (0, j);
+                               }
+
+                               // Put the right method names in the frames
+                               for (int i = 0; i < backtraces.Length; ++i)
+                                       for (int j = 0; j < backtraces 
[i].Frames.Length; ++j)
+                                               GetMethod (backtraces 
[i].Frames [j].MethodCode,
+                                                          out backtraces 
[i].Frames [j].MethodName,
+                                                          out backtraces 
[i].Frames [j].MethodArguments);
+
+                               // Re-open the file for use as a lazy reader.
+                               stream = new FileStream (filename, 
FileMode.Open, FileAccess.Read);
+                               lazy_reader = new BinaryReader (stream);
                        }
                }
 
@@ -761,15 +775,11 @@
                        // and replace the backtrace codes.
                        for (int i = 0; i < backtraces.Length; ++i) {
                                backtrace_type_codes [i] = TranslateTypeCode 
(backtrace_type_codes [i]);
-                               backtraces [i].Type = types 
[backtrace_type_codes [i]];
                                for (int j = 0; j < backtraces 
[i].Frames.Length; ++j) {
                                        uint code;
                                        code = backtraces [i].Frames 
[j].MethodCode;
                                        code = TranslateMethodCode (code);
                                        backtraces [i].Frames [j].MethodCode = 
code;
-                                       GetMethod (code,
-                                                  out backtraces [i].Frames 
[j].MethodName,
-                                                  out backtraces [i].Frames 
[j].MethodArguments);
                                }
                        }
 
@@ -779,6 +789,12 @@
                        combsort_types (SortOrder.ByName);
                        combsort_methods (SortOrder.ByName);
 
+                       // Populate the backtrace types and codes
+                       for (int i = 0; i < backtraces.Length; ++i) {
+                               backtraces [i].Code = TranslateBacktraceCode 
(backtraces [i].Code);
+                               backtraces [i].Type = types 
[backtrace_type_codes [i]];
+                       }
+
                        // After remapping the codes, we don't need these any 
more.
                        type_codes_old = null;
                        type_codes_new = null;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to