From c93e127e7a2040f74655937fedb5a9d439c03aa9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 12 Jan 2013 14:28:23 +0000 Subject: code cleanup: style and replace (float)sin, (float)cos with sinf, cosf --- source/creator/creator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/creator') diff --git a/source/creator/creator.c b/source/creator/creator.c index 4a2274180e7..70123187721 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -516,7 +516,7 @@ static void blender_crash_handler(int signum) fp = BLI_fopen(fname, "wb"); if (fp == NULL) { fprintf(stderr, "Unable to save '%s': %s\n", - fname, errno ? strerror(errno) : "Unknown error opening file"); + fname, errno ? strerror(errno) : "Unknown error opening file"); } else { if (wm) { -- cgit v1.2.3 From 4f938bbbfe6e1a5d57e98e60c37c47582d904dc1 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Sun, 13 Jan 2013 15:01:34 +0000 Subject: Add terminate call for crash handler for windows. Also add inactive code to do backtrace flushing. This code will need DbgHelp.lib which we may want to only include for debug builds if at all. --- source/creator/creator.c | 48 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 10 deletions(-) (limited to 'source/creator') diff --git a/source/creator/creator.c b/source/creator/creator.c index 70123187721..68a4866a381 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -46,16 +46,19 @@ #else # include /* getpid */ #endif -/* for backtrace */ -#ifndef WIN32 -# include -#endif #ifdef WIN32 # include # include "utfconv.h" #endif +/* for backtrace */ +#ifdef WIN32 +# include +#else +# include +#endif + #include #include #include @@ -446,8 +449,8 @@ static int set_fpe(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(dat static void blender_crash_handler_backtrace(FILE *fp) { -#ifndef WIN32 #define SIZE 100 +#ifndef WIN32 void *buffer[SIZE]; int nptrs; char **strings; @@ -464,12 +467,38 @@ static void blender_crash_handler_backtrace(FILE *fp) } free(strings); -#undef SIZE -#else /* WIN32 */ - /* TODO */ +#else /* WIN32 */ (void)fp; +#if 0 + #define MAXSYMBOL 256 + unsigned short i; + void *stack[SIZE]; + unsigned short nframes; + SYMBOL_INFO *symbolinfo; + HANDLE process; + + process = GetCurrentProcess(); + + SymInitialize(process, NULL, TRUE); + + nframes = CaptureStackBackTrace(0, SIZE, stack, NULL); + symbolinfo = MEM_callocN(sizeof(SYMBOL_INFO) + MAXSYMBOL * sizeof( char ), "crash Symbol table"); + symbolinfo->MaxNameLen = MAXSYMBOL - 1; + symbolinfo->SizeOfStruct = sizeof(SYMBOL_INFO); + + for( i = 0; i < nframes; i++ ) + { + SymFromAddr(process, ( DWORD64 )( stack[ i ] ), 0, symbolinfo); + + fprintf(fp, "%u: %s - 0x%0X\n", nframes - i - 1, symbolinfo->Name, symbolinfo->Address); + } + + MEM_freeN(symbolinfo); #endif +#endif +#undef SIZE } + static void blender_crash_handler(int signum) { @@ -534,8 +563,7 @@ static void blender_crash_handler(int signum) #ifndef WIN32 kill(getpid(), signum); #else - /* force crash on windows for now */ - *((void **)NULL) = NULL; + TerminateProcess(GetCurrentProcess(), signum); #endif } -- cgit v1.2.3 From 9b57b2315cfc933e699775f2a005b0b03069e156 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 17 Jan 2013 09:11:51 +0000 Subject: include svn revision in the crash log, also free smoothview on the off-chance you manage to exit blender while the view is moving :) --- source/creator/creator.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'source/creator') diff --git a/source/creator/creator.c b/source/creator/creator.c index 68a4866a381..6cee9b09a52 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -165,9 +165,10 @@ static int print_version(int argc, const char **argv, void *data); /* for the callbacks: */ -#define BLEND_VERSION_STRING_FMT \ - "Blender %d.%02d (sub %d)\n", \ - BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION \ +#define BLEND_VERSION_FMT "Blender %d.%02d (sub %d)" +#define BLEND_VERSION_ARG BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION +/* pass directly to printf */ +#define BLEND_VERSION_STRING_FMT BLEND_VERSION_FMT "\n", BLEND_VERSION_ARG /* Initialize callbacks for the modules that need them */ static void setCallbacks(void); @@ -538,7 +539,13 @@ static void blender_crash_handler(int signum) printf("Writing: %s\n", fname); fflush(stdout); - BLI_snprintf(header, sizeof(header), "# " BLEND_VERSION_STRING_FMT); + BLI_snprintf(header, sizeof(header), "# " BLEND_VERSION_FMT ", Revision: %s\n", BLEND_VERSION_ARG, +#ifdef BUILD_DATE + build_rev +#else + "Unknown" +#endif + ); /* open the crash log */ errno = 0; -- cgit v1.2.3 From b7a2402da68accb283314bc7929d037e1a115da9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 18 Jan 2013 21:05:37 +0000 Subject: fix for building with BSD & MinGW. --- source/creator/creator.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'source/creator') diff --git a/source/creator/creator.c b/source/creator/creator.c index 6cee9b09a52..624b1148072 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -53,10 +53,10 @@ #endif /* for backtrace */ -#ifdef WIN32 -# include -#else +#if defined(__linux__) || defined(__APPLE__) # include +#elif defined(_MSV_VER) +# include #endif #include @@ -448,10 +448,12 @@ static int set_fpe(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(dat return 0; } +#if defined(__linux__) || defined(__APPLE__) + +/* Unix */ static void blender_crash_handler_backtrace(FILE *fp) { #define SIZE 100 -#ifndef WIN32 void *buffer[SIZE]; int nptrs; char **strings; @@ -468,10 +470,17 @@ static void blender_crash_handler_backtrace(FILE *fp) } free(strings); -#else /* WIN32 */ +#undef SIZE +} + +#elif defined(_MSV_VER) + +static void blender_crash_handler_backtrace(FILE *fp) +{ (void)fp; + #if 0 - #define MAXSYMBOL 256 +#define MAXSYMBOL 256 unsigned short i; void *stack[SIZE]; unsigned short nframes; @@ -496,10 +505,17 @@ static void blender_crash_handler_backtrace(FILE *fp) MEM_freeN(symbolinfo); #endif -#endif -#undef SIZE } +#else /* non msvc/osx/linux */ + +static void blender_crash_handler_backtrace(FILE *fp) +{ + (void)fp; +} + +#endif + static void blender_crash_handler(int signum) { -- cgit v1.2.3 From 5c85deb28570a911e825af5923a7939ca5781ee7 Mon Sep 17 00:00:00 2001 From: Sergej Reich Date: Wed, 23 Jan 2013 05:56:13 +0000 Subject: rigidbody: Add rigidbody module It's mostly a C API for bullet that interfaces nicely with blender. It could act as a generic interface for rigid body simulations but right now it's very specific to bullet. TODO: Fix building without bullet. Part of GSoC 2010 and 2012. Authors: Joshua Leung (aligorith), Sergej Reich (sergof) --- source/creator/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'source/creator') diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 72f11326af7..7362745f412 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -856,6 +856,7 @@ endif() bf_modifiers bf_bmesh bf_blenkernel + bf_rigidbody bf_nodes bf_gpu bf_blenloader -- cgit v1.2.3 From 69ddc5eb99d36c7d2cf86a7537a3784d3c72777e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 23 Jan 2013 07:26:39 +0000 Subject: make bullet optional again --- source/creator/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/creator') diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 7362745f412..2115b2a5ff6 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -856,7 +856,6 @@ endif() bf_modifiers bf_bmesh bf_blenkernel - bf_rigidbody bf_nodes bf_gpu bf_blenloader @@ -971,6 +970,10 @@ endif() list(APPEND BLENDER_SORTED_LIBS bf_intern_locale) endif() + if(WITH_BULLET) + list_insert_after(BLENDER_SORTED_LIBS "bf_blenkernel" "bf_rigidbody") + endif() + if(WITH_BULLET AND NOT WITH_BULLET_SYSTEM) list_insert_after(BLENDER_SORTED_LIBS "ge_logic_ngnetwork" "extern_bullet") endif() -- cgit v1.2.3