changeset 229:d02819f051cc

extend PrintStackTrace
author Frank Benoit <benoit@tionex.de>
date Sat, 12 Apr 2008 17:49:18 +0200
parents a8304c57f9d8
children 19ce131cbd99
files dwt/dwthelper/utils.d
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/dwthelper/utils.d	Fri Apr 11 23:21:55 2008 +0200
+++ b/dwt/dwthelper/utils.d	Sat Apr 12 17:49:18 2008 +0200
@@ -929,14 +929,15 @@
     return res;
 }
 
-void PrintStackTrace(){
-    try{
-        throw new Exception( null );
-    }
-    catch( Exception e ){
-        foreach( msg; e.info ){
-            Trace.formatln( "trc: {}", msg );
+void PrintStackTrace( int deepth = 100, char[] prefix = "trc" ){
+    auto e = new Exception( null );
+    int idx = 0;
+    const start = 3;
+    foreach( msg; e.info ){
+        if( idx >= start && idx < start+deepth ) {
+            Trace.formatln( "{}: {}", prefix, msg );
         }
+        idx++;
     }
 }