From fd6d4e2fd7212359e5be778f9f8748ee21babd53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Thu, 22 Sep 2016 23:41:10 +0200 Subject: [PATCH] Add variable to identify crashes in original code --- src/addresses.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/addresses.c b/src/addresses.c index c32e8e20fd..6aed725f01 100644 --- a/src/addresses.c +++ b/src/addresses.c @@ -28,9 +28,14 @@ #define DISABLE_OPT #endif // defined(__GNUC__) +// This variable serves a purpose of identifying a crash if it has happened inside original code. +// When switching to original code, stack frame pointer is modified and prevents breakpad from providing stack trace. +volatile int _originalAddress = 0; + int DISABLE_OPT RCT2_CALLPROC_X(int address, int _eax, int _ebx, int _ecx, int _edx, int _esi, int _edi, int _ebp) { int result = 0; + _originalAddress = address; #if defined(PLATFORM_X86) && !defined(NO_RCT2) #ifdef _MSC_VER __asm { @@ -76,6 +81,7 @@ int DISABLE_OPT RCT2_CALLPROC_X(int address, int _eax, int _ebx, int _ecx, int _ ); #endif #endif // PLATFORM_X86 + _originalAddress = 0; // lahf only modifies ah, zero out the rest return result & 0xFF00; } @@ -83,6 +89,7 @@ int DISABLE_OPT RCT2_CALLPROC_X(int address, int _eax, int _ebx, int _ecx, int _ int DISABLE_OPT RCT2_CALLFUNC_X(int address, int *_eax, int *_ebx, int *_ecx, int *_edx, int *_esi, int *_edi, int *_ebp) { int result = 0; + _originalAddress = address; #if defined(PLATFORM_X86) && !defined(NO_RCT2) #ifdef _MSC_VER __asm { @@ -229,6 +236,7 @@ int DISABLE_OPT RCT2_CALLFUNC_X(int address, int *_eax, int *_ebx, int *_ecx, in ); #endif #endif // PLATFORM_X86 + _originalAddress = 0; // lahf only modifies ah, zero out the rest return result & 0xFF00; }