Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Molenkamp <github@lazydodo.com>2020-05-10 03:12:14 +0300
committerRay Molenkamp <github@lazydodo.com>2020-05-10 03:12:14 +0300
commit76e56e2ba70f4535da70b3e55d4b18ac3cd19820 (patch)
tree21195cfa960de6b37619410d9dc6cb3ad8567dfd /source/blender/blenlib
parentf2178b7f9740c55caf047e6bd19b9dc73a4837ef (diff)
Windows: Ignore context record for backtrace is address is 0.
T76602 reported a crash with the exception address being 0, this stack naturally could not be walked and no backtrace was reported for the main thread. Which would have been helpful. This change modifies the behaviour of the crash handler to ignore the context record if it contains no useful information and walk the current stack to get some information about what lead to the crash.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/system_win32.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/system_win32.c b/source/blender/blenlib/intern/system_win32.c
index 203c9673a9e..d60f54ebe67 100644
--- a/source/blender/blenlib/intern/system_win32.c
+++ b/source/blender/blenlib/intern/system_win32.c
@@ -307,13 +307,14 @@ static bool BLI_windows_system_backtrace_stack(FILE *fp)
{
fprintf(fp, "Stack trace:\n");
/* If we are handling an exception use the context record from that. */
- if (current_exception) {
+ if (current_exception && current_exception->ExceptionRecord->ExceptionAddress) {
/* The back trace code will write to the context record, to protect the original record from
* modifications give the backtrace a copy to work on. */
CONTEXT TempContext = *current_exception->ContextRecord;
return BLI_windows_system_backtrace_run_trace(fp, GetCurrentThread(), &TempContext);
}
else {
+ /* If there is no current exception or the address is not set, walk the current stack. */
return bli_windows_system_backtrace_stack_thread(fp, GetCurrentThread());
}
}
@@ -403,6 +404,7 @@ void BLI_windows_handle_exception(EXCEPTION_POINTERS *exception)
CHAR modulename[MAX_PATH];
bli_windows_get_module_name(address, modulename, sizeof(modulename));
fprintf(stderr, "Module : %s\n", modulename);
+ fprintf(stderr, "Thread : %.8x\n", GetCurrentThreadId());
}
fflush(stderr);
}