[Fusionforge-commits] r13469 - branches/Branch_5_1/src/utils trunk/src/utils

Thorsten Glaser mirabilos at fusionforge.org
Fri Jun 3 12:14:24 CEST 2011


Author: mirabilos
Date: 2011-06-03 12:14:24 +0200 (Fri, 03 Jun 2011)
New Revision: 13469

Modified:
   branches/Branch_5_1/src/utils/include.pl
   trunk/src/utils/include.pl
Log:
function to display a backtrace in Perl, should anyone ever need it

room for improvement: display the arguments (and maybe locals),
if it can be done, like in PHP?\226?\128?\153s


Modified: branches/Branch_5_1/src/utils/include.pl
===================================================================
--- branches/Branch_5_1/src/utils/include.pl	2011-06-01 12:04:12 UTC (rev 13468)
+++ branches/Branch_5_1/src/utils/include.pl	2011-06-03 10:14:24 UTC (rev 13469)
@@ -87,3 +87,18 @@
         }
         return 0;
 }      
+
+#######################
+# Display a backtrace #
+#######################
+sub
+debug_print_backtrace
+{
+	my $i = 1;
+
+	print "Call Trace:\n";
+	while ((my @call_details = (caller($i++)))) {
+		print " + " . $call_details[1] . ":" . $call_details[2] .
+		    " in function " . $call_details[3] . "\n";
+	}
+}

Modified: trunk/src/utils/include.pl
===================================================================
--- trunk/src/utils/include.pl	2011-06-01 12:04:12 UTC (rev 13468)
+++ trunk/src/utils/include.pl	2011-06-03 10:14:24 UTC (rev 13469)
@@ -93,3 +93,18 @@
         }
         return 0;
 }      
+
+#######################
+# Display a backtrace #
+#######################
+sub
+debug_print_backtrace
+{
+	my $i = 1;
+
+	print "Call Trace:\n";
+	while ((my @call_details = (caller($i++)))) {
+		print " + " . $call_details[1] . ":" . $call_details[2] .
+		    " in function " . $call_details[3] . "\n";
+	}
+}




More information about the Fusionforge-commits mailing list