소스 검색

2002-06-19 Dietmar Maurer <[email protected]>

	* StackTrace.cs: impl. remaining constructors.

svn path=/trunk/mcs/; revision=5338
Dietmar Maurer 23 년 전
부모
커밋
94faa65b9f
2개의 변경된 파일33개의 추가작업 그리고 5개의 파일을 삭제
  1. 4 0
      mcs/class/corlib/System.Diagnostics/ChangeLog
  2. 29 5
      mcs/class/corlib/System.Diagnostics/StackTrace.cs

+ 4 - 0
mcs/class/corlib/System.Diagnostics/ChangeLog

@@ -1,3 +1,7 @@
+2002-06-19  Dietmar Maurer  <[email protected]>
+
+	* StackTrace.cs: impl. remaining constructors.
+
 2002-06-18  Dietmar Maurer  <[email protected]>
 
 	* StackTrace.cs: use new internal call for constructors, use MS like

+ 29 - 5
mcs/class/corlib/System.Diagnostics/StackTrace.cs

@@ -12,6 +12,7 @@ using System;
 using System.Reflection;
 using System.Threading;
 using System.Runtime.CompilerServices;
+using System.Collections;
 
 namespace System.Diagnostics {
         /// <summary>
@@ -35,7 +36,9 @@ namespace System.Diagnostics {
                 ///   Initializes a new instance of the StackTrace class.
                 /// </summary>
 		[MonoTODO]
-                public StackTrace() : this (METHODS_TO_SKIP, false) {}
+                public StackTrace() {
+			init_frames (METHODS_TO_SKIP, false);
+		}
                 
                 /// <summary>
                 ///   Initializes a new instance of the StackTrace class.
@@ -43,7 +46,9 @@ namespace System.Diagnostics {
                 /// <param name="needFileInfo">
                 ///   TODO:
                 /// </param>
-                public StackTrace(bool needFileInfo) : this (METHODS_TO_SKIP, needFileInfo) {}
+                public StackTrace(bool needFileInfo) {
+			init_frames (METHODS_TO_SKIP, needFileInfo);
+		}
 
                 /// <summary>
                 ///   Initializes a new instance of the StackTrace class
@@ -53,7 +58,9 @@ namespace System.Diagnostics {
                 ///   The number of frames up the stack to start the trace
                 ///   from.
                 /// </param>
-                public StackTrace(int skipFrames) : this (skipFrames, false) {}
+                public StackTrace(int skipFrames) {
+			init_frames (skipFrames, false);
+		}
 
 		/// <summary>
                 ///   Initializes a new instance of the StackTrace class
@@ -67,9 +74,26 @@ namespace System.Diagnostics {
                 ///   TODO:
                 /// </param>
                 public StackTrace(int skipFrames, bool needFileInfo) {
-                        throw new NotImplementedException();			
+			init_frames (skipFrames, needFileInfo);
 		}
-                
+
+		void init_frames (int skipFrames, bool needFileInfo)
+		{
+			StackFrame sf;
+			ArrayList al = new ArrayList ();
+
+			skipFrames += 2;
+			
+			while ((sf = new StackFrame (skipFrames, needFileInfo)) != null &&
+			       sf.GetMethod () != null) {
+				
+				al.Add (sf);
+				skipFrames++;
+			};
+
+                        frames = (StackFrame [])al.ToArray (typeof (StackFrame));	
+		}
+		
 		[MethodImplAttribute(MethodImplOptions.InternalCall)]
 		extern static StackFrame [] get_trace (Exception e, int skipFrames, bool needFileInfo);