[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26584] trunk/blender/source/creator/ creator.c: use fpe_handler on linux when running with -d, this runs a function rarther then quitting, use for setting breakpoints to find where nan/inf occur.

Campbell Barton ideasman42 at gmail.com
Wed Feb 3 16:50:08 CET 2010


Revision: 26584
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26584
Author:   campbellbarton
Date:     2010-02-03 16:50:08 +0100 (Wed, 03 Feb 2010)

Log Message:
-----------
use fpe_handler on linux when running with -d, this runs a function rarther then quitting, use for setting breakpoints to find where nan/inf occur.

Modified Paths:
--------------
    trunk/blender/source/creator/creator.c

Modified: trunk/blender/source/creator/creator.c
===================================================================
--- trunk/blender/source/creator/creator.c	2010-02-03 15:44:19 UTC (rev 26583)
+++ trunk/blender/source/creator/creator.c	2010-02-03 15:50:08 UTC (rev 26584)
@@ -134,7 +134,8 @@
 /* Initialise callbacks for the modules that need them */
 static void setCallbacks(void); 
 
-#if defined(__sgi) || defined(__alpha__)
+/* on linux set breakpoints here when running in debug mode, useful to catch floating point errors */
+#if defined(__sgi) || defined(__linux__)
 static void fpe_handler(int sig)
 {
 	// printf("SIGFPE trapped\n");
@@ -899,14 +900,6 @@
 #ifdef __FreeBSD__
 	fpsetmask(0);
 #endif
-#ifdef __linux__
-    #ifdef __alpha__
-	signal (SIGFPE, fpe_handler);
-    #endif
-#endif
-#if defined(__sgi)
-	signal (SIGFPE, fpe_handler);
-#endif
 
 	// copy path to executable in bprogname. playanim and creting runtimes
 	// need this.
@@ -947,11 +940,17 @@
 	setuid(getuid()); /* end superuser */
 #endif
 
+#if defined(__sgi) || defined(__linux__)
+	if(G.f & G_DEBUG) {
+		/* zealous but makes float issues a heck of a lot easier to find!
+		 * set breakpoints on fpe_handler */
+		signal(SIGFPE, fpe_handler);
+
 #ifdef __linux__
-	/* zealous but makes float issues a heck of a lot easier to find! */
-	if(G.f & G_DEBUG)
 		feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW );
 #endif
+	}
+#endif
 
 	/* for all platforms, even windos has it! */
 	if(G.background) signal(SIGINT, blender_esc);	/* ctrl c out bg render */





More information about the Bf-blender-cvs mailing list