[Bf-blender-cvs] [03f4d20bcf7] master: Revert "Windows: Support backtraces on release builds."
Ray Molenkamp
noreply at git.blender.org
Thu Apr 30 22:00:26 CEST 2020
Commit: 03f4d20bcf7f1819f31aa78315a7e8358928ca68
Author: Ray Molenkamp
Date: Thu Apr 30 14:00:11 2020 -0600
Branches: master
https://developer.blender.org/rB03f4d20bcf7f1819f31aa78315a7e8358928ca68
Revert "Windows: Support backtraces on release builds."
Issues with older cmake.
===================================================================
M CMakeLists.txt
M build_files/cmake/platform/platform_win32.cmake
M source/blender/blenlib/BLI_system.h
M source/blender/blenlib/CMakeLists.txt
M source/blender/blenlib/intern/system.c
D source/blender/blenlib/intern/system_win32.c
M source/creator/CMakeLists.txt
M source/creator/creator_signals.c
===================================================================
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 64b7a411679..1201ddda333 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -547,12 +547,6 @@ if(WIN32)
option(WITH_WINDOWS_SCCACHE "Use sccache to speed up builds (Ninja builder only)" OFF)
mark_as_advanced(WITH_WINDOWS_SCCACHE)
- option(WITH_WINDOWS_PDB "Generate a pdb file for client side stacktraces" ON)
- mark_as_advanced(WITH_WINDOWS_PDB)
-
- option(WITH_WINDOWS_STRIPPED_PDB "Use a stripped PDB file" On)
- mark_as_advanced(WITH_WINDOWS_STRIPPED_PDB)
-
endif()
# The following only works with the Ninja generator in CMake >= 3.0.
diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake
index 25b4f5fd81d..90c230f5ce5 100644
--- a/build_files/cmake/platform/platform_win32.cmake
+++ b/build_files/cmake/platform/platform_win32.cmake
@@ -51,10 +51,6 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} \"${CLANG_OPENMP_LIB}\"")
endif()
- if(WITH_WINDOWS_STRIPPED_PDB)
- message(WARNING "stripped pdb not supported with clang, disabling..")
- set(WITH_WINDOWS_STRIPPED_PDB Off)
- endif()
endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ${WINDOWS_USE_VISUAL_STUDIO_PROJECT_FOLDERS})
@@ -116,7 +112,7 @@ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO")
list(APPEND PLATFORM_LINKLIBS
- ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 Comctl32 version
+ ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 Comctl32
advapi32 shfolder shell32 ole32 oleaut32 uuid psapi Dbghelp Shlwapi
)
@@ -140,11 +136,6 @@ add_definitions(-D_WIN32_WINNT=0x601)
include(build_files/cmake/platform/platform_win32_bundle_crt.cmake)
remove_cc_flag("/MDd" "/MD" "/Zi")
-if(WITH_WINDOWS_PDB)
- set(PDB_INFO_OVERRIDE_FLAGS "/Z7")
- set(PDB_INFO_OVERRIDE_LINKER_FLAGS "/DEBUG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
-endif()
-
if(MSVC_CLANG) # Clangs version of cl doesn't support all flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_WARN_FLAGS} /nologo /J /Gd /EHsc -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference ")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /nologo /J /Gd -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference")
@@ -177,10 +168,10 @@ endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd ${SYMBOL_FORMAT}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MDd ${SYMBOL_FORMAT}")
-set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD ${PDB_INFO_OVERRIDE_FLAGS}")
-set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MD ${PDB_INFO_OVERRIDE_FLAGS}")
-set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MD ${PDB_INFO_OVERRIDE_FLAGS}")
-set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MD ${PDB_INFO_OVERRIDE_FLAGS}")
+set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD")
+set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MD")
+set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MD")
+set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MD")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MD ${SYMBOL_FORMAT}")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MD ${SYMBOL_FORMAT}")
unset(SYMBOL_FORMAT)
@@ -195,7 +186,6 @@ set(PLATFORM_LINKFLAGS_DEBUG "${PLATFORM_LINKFLAGS_DEBUG} /IGNORE:4099 /NODEFAUL
# Ignore meaningless for us linker warnings.
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /ignore:4049 /ignore:4217 /ignore:4221")
-set(PLATFORM_LINKFLAGS_RELEASE "${PLATFORM_LINKFLAGS} ${PDB_INFO_OVERRIDE_LINKER_FLAGS}")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221")
if(CMAKE_CL_64)
diff --git a/source/blender/blenlib/BLI_system.h b/source/blender/blenlib/BLI_system.h
index 50f8adc20f6..8c0c9ad99bf 100644
--- a/source/blender/blenlib/BLI_system.h
+++ b/source/blender/blenlib/BLI_system.h
@@ -53,10 +53,6 @@ int BLI_system_memory_max_in_megabytes_int(void);
/* getpid */
#ifdef WIN32
# define BLI_SYSTEM_PID_H <process.h>
-
-/* void* since we really do not want to drag Windows.h in to get the proper typedef. */
-void BLI_windows_handle_exception(void *exception);
-
#else
# define BLI_SYSTEM_PID_H <unistd.h>
#endif
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index d3bfb553329..52b302f99d4 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -295,9 +295,6 @@ if(WIN32)
list(APPEND LIB
bf_intern_utfconv
)
- list(APPEND SRC
- intern/system_win32.c
- )
endif()
diff --git a/source/blender/blenlib/intern/system.c b/source/blender/blenlib/intern/system.c
index f0597b0e9e7..7d9ed2598a6 100644
--- a/source/blender/blenlib/intern/system.c
+++ b/source/blender/blenlib/intern/system.c
@@ -32,7 +32,11 @@
/* for backtrace and gethostname/GetComputerName */
#if defined(WIN32)
# include <intrin.h>
-# include "BLI_winstuff.h"
+# include <windows.h>
+# pragma warning(push)
+# pragma warning(disable : 4091)
+# include <dbghelp.h>
+# pragma warning(pop)
#else
# include <execinfo.h>
# include <unistd.h>
@@ -70,8 +74,6 @@ int BLI_cpu_support_sse2(void)
#endif
}
-/* Windows stackwalk lives in system_win32.c */
-#if !defined(_MSC_VER)
/**
* Write a backtrace into a file for systems which support it.
*/
@@ -79,9 +81,9 @@ void BLI_system_backtrace(FILE *fp)
{
/* ------------- */
/* Linux / Apple */
-# if defined(__linux__) || defined(__APPLE__)
+#if defined(__linux__) || defined(__APPLE__)
-# define SIZE 100
+# define SIZE 100
void *buffer[SIZE];
int nptrs;
char **strings;
@@ -96,15 +98,48 @@ void BLI_system_backtrace(FILE *fp)
}
free(strings);
-# undef SIZE
+# undef SIZE
+
+ /* -------- */
+ /* Windows */
+#elif defined(_MSC_VER)
+
+# ifndef NDEBUG
+# define MAXSYMBOL 256
+# define SIZE 100
+ 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%0llX\n", nframes - i - 1, symbolinfo->Name, symbolinfo->Address);
+ }
+
+ MEM_freeN(symbolinfo);
+# undef MAXSYMBOL
+# undef SIZE
# else
+ fprintf(fp, "Crash backtrace not supported on release builds\n");
+# endif /* NDEBUG */
+#else /* _MSC_VER */
/* ------------------ */
/* non msvc/osx/linux */
(void)fp;
-# endif
-}
#endif
+}
/* end BLI_system_backtrace */
/* NOTE: The code for CPU brand string is adopted from Cycles. */
diff --git a/source/blender/blenlib/intern/system_win32.c b/source/blender/blenlib/intern/system_win32.c
deleted file mode 100644
index f4c9057114c..00000000000
--- a/source/blender/blenlib/intern/system_win32.c
+++ /dev/null
@@ -1,375 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-/** \file
- * \ingroup bli
- */
-#include <Windows.h>
-#include <stdio.h>
-
-#include <dbghelp.h>
-#include <shlwapi.h>
-#include <tlhelp32.h>
-
-#include "BLI_fileops.h"
-#include "BLI_path_util.h"
-#include "BLI_string.h"
-
-#include "MEM_guardedalloc.h"
-
-static EXCEPTION_POINTERS *current_exception;
-
-static const char *bli_windows_get_exception_description(const DWORD exceptioncode)
-{
- switch (exceptioncode) {
- case EXCEPTION_ACCESS_VIOLATION:
- return "EXCEPTION_ACCESS_VIOLATION";
- case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
- return "EXCEPTION_ARRAY_BOUNDS_EXCEEDED";
- case EXCEPTION_BREAKPOINT:
- return "EXCEPTION_BREAKPOINT";
- case EXCEPTION_DATATYPE_MISALIGNMENT:
- return "EXCEPTION_DATATYPE_MISALIGNMENT";
- case EXCEPTION_FLT_DENORMAL_OPERAND:
- return "EXCEPTION_FLT_DENORMAL_OPERAND";
- case EXCEPTION_FLT_DIVIDE_BY_ZERO:
- return "EXCEPTION_FLT_DIVIDE_BY_ZERO";
- case EXCEPTION_FLT_INEXACT_RESULT:
- return "EXCEPTION_FLT_INEXACT_RESULT";
- case EXCEPTION_FLT_INVALID_OPERATION:
- return "EXCEPTION_FLT_INVALID_OPERATION";
- case EXCEPTION_FLT_OVERFLOW:
- return "EXCEPTION_FLT_OVERFLOW";
- case EXCEPTION_FLT_STACK_CHECK:
- return "EXCEPTION_FLT_STACK_CHECK";
- case EXCEPTION_FLT_UNDERFLOW:
- return "EXCEPTION_FLT_UNDERFLOW";
- case EXCEPTION_ILLEGAL_INSTRUCTION:
- return "EXCEPTION_ILLEGAL_INSTRUCTION";
- case EXCEPTION_IN_PAGE_ERROR:
- return "EXCEPTION_IN_PAGE_ERROR";
- case EXCEPTION_INT_DIVIDE_BY_ZERO:
- return "EXCEPTION_INT_DIVIDE_BY_ZERO";
- case EXCEPTION_INT_OVERFLOW:
- return "EXCEPTION_INT_OVERFLOW";
- case EXCEPTION_INVALID_DISPOSITION:
- return "EXCEPTION_INVALID_DISPOSITION";
- case EXCEPTION_NONCONTINUABLE_EXCEPTION:
- return "EXCEPTION_NONCONTINUABLE_EXCEPTION";
- case EXCEPTION_PRIV_INSTRUCTION:
- return "EXCEPTION_PRIV_INSTRUCTION";
- case EXCEPTION_SINGLE_STEP:
- return "EXCEPTION_SINGLE_STEP";
- case EXCEPTION_STACK_OVERFLOW:
- return "EXCEPTION_STACK_OVERFLOW";
- default:
- return "UNKNOWN EXCEPTION";
- }
-}
-
-static void bli_windows_get_module_name(LPVOID address, PCHAR
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list