diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-02-03 18:50:08 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-02-03 18:50:08 +0300 |
commit | 61457571af4f67aeecfbc44def23fd3994784df1 (patch) | |
tree | facb2b9fe674b572aff5f00528c3bd887644db41 /source/creator | |
parent | fb728addd2c0b7f89f8fb9d593cf1f1af8caf218 (diff) |
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.
Diffstat (limited to 'source/creator')
-rw-r--r-- | source/creator/creator.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/source/creator/creator.c b/source/creator/creator.c index 7939ea30721..93255dba8de 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -134,7 +134,8 @@ char blender_path[FILE_MAXDIR+FILE_MAXFILE] = BLENDERPATH; /* 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 @@ int main(int argc, char **argv) #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 @@ int main(int argc, char **argv) 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 */ |