core: Let's try getting crash callstacks on win32 with a vectored exception handler.
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				Build Tilde Friends / Build-All (push) Has been cancelled
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	Build Tilde Friends / Build-All (push) Has been cancelled
				
			This commit is contained in:
		
							
								
								
									
										21
									
								
								src/main.c
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								src/main.c
									
									
									
									
									
								
							| @@ -1008,6 +1008,23 @@ static void _error_handler(int sig) | |||||||
| 	_exit(1); | 	_exit(1); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | #if defined(_WIN32) | ||||||
|  | static LONG WINAPI _win32_exception_handler(EXCEPTION_POINTERS* info) | ||||||
|  | { | ||||||
|  | 	if (info->ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION || | ||||||
|  | 		info->ExceptionRecord->ExceptionCode == STATUS_ILLEGAL_INSTRUCTION || | ||||||
|  | 		info->ExceptionRecord->ExceptionCode == STATUS_STACK_OVERFLOW || | ||||||
|  | 		info->ExceptionRecord->ExceptionCode == STATUS_HEAP_CORRUPTION) | ||||||
|  | 	{ | ||||||
|  | 		const char* stack = tf_util_backtrace_string(); | ||||||
|  | 		tf_printf("ERROR:\n%s\n", stack); | ||||||
|  | 		tf_free((void*)stack); | ||||||
|  | 		_exit(1); | ||||||
|  | 	} | ||||||
|  | 	return EXCEPTION_CONTINUE_SEARCH; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
| static void _startup(int argc, char* argv[]) | static void _startup(int argc, char* argv[]) | ||||||
| { | { | ||||||
| 	char buffer[8] = { 0 }; | 	char buffer[8] = { 0 }; | ||||||
| @@ -1055,6 +1072,10 @@ static void _startup(int argc, char* argv[]) | |||||||
| 			perror("signal"); | 			perror("signal"); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | #if defined(_WIN32) | ||||||
|  | 	AddVectoredExceptionHandler(0, _win32_exception_handler); | ||||||
|  | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
| #if defined(__ANDROID__) | #if defined(__ANDROID__) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user