Changes in src/libcfa/exception.c [e9145a3:cbce272]
- File:
-
- 1 edited
-
src/libcfa/exception.c (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/exception.c
re9145a3 rcbce272 10 10 // Created On : Mon Jun 26 15:13:00 2017 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Aug 17 15:45:00 201713 // Update Count : 712 // Last Modified On : Fri Aug 4 15:20:00 2017 13 // Update Count : 6 14 14 // 15 15 … … 23 23 #include <stdio.h> 24 24 #include <unwind.h> 25 #include <libhdr/libdebug.h>26 25 27 26 // FIX ME: temporary hack to keep ARM build working … … 80 79 void __cfaehm__throw_resume(exception * except) { 81 80 82 LIB_DEBUG_PRINT_SAFE("Throwing resumption exception\n"); 81 // DEBUG 82 printf("Throwing resumption exception\n"); 83 83 84 84 struct __cfaehm__try_resume_node * original_head = shared_stack.current_resume; … … 94 94 } 95 95 96 LIB_DEBUG_PRINT_SAFE("Unhandled exception\n");96 printf("Unhandled exception\n"); 97 97 shared_stack.current_resume = original_head; 98 98 … … 106 106 107 107 void __cfaehm__try_resume_setup(struct __cfaehm__try_resume_node * node, 108 _Bool(*handler)(exception * except)) {108 int (*handler)(exception * except)) { 109 109 node->next = shared_stack.top_resume; 110 110 node->handler = handler; … … 154 154 struct exception_context_t * context = this_exception_context(); 155 155 156 LIB_DEBUG_PRINT_SAFE("Deleting Exception\n"); 156 // DEBUG 157 printf( "Deleting Exception\n"); 157 158 158 159 // Remove the exception from the list. … … 234 235 235 236 void __cfaehm__throw_terminate( exception * val ) { 236 LIB_DEBUG_PRINT_SAFE("Throwing termination exception\n"); 237 // DEBUG 238 printf("Throwing termination exception\n"); 237 239 238 240 __cfaehm__allocate_exception( val ); … … 241 243 242 244 void __cfaehm__rethrow_terminate(void) { 243 LIB_DEBUG_PRINT_SAFE("Rethrowing termination exception\n"); 245 // DEBUG 246 printf("Rethrowing termination exception\n"); 244 247 245 248 __cfaehm__begin_unwind(); … … 254 257 { 255 258 256 //LIB_DEBUG_PRINT_SAFE("CFA: 0x%lx\n", _Unwind_GetCFA(context)); 257 LIB_DEBUG_PRINT_SAFE("Personality function (%d, %x, %llu, %p, %p):", version, actions, exceptionClass, unwind_exception, context); 259 // DEBUG 260 //printf("CFA: 0x%lx\n", _Unwind_GetCFA(context)); 261 printf("Personality function (%d, %x, %llu, %p, %p):", version, actions, exceptionClass, unwind_exception, context); 258 262 259 263 // If we've reached the end of the stack then there is nothing much we can do... 260 264 if( actions & _UA_END_OF_STACK ) return _URC_END_OF_STACK; 261 265 266 // DEBUG 262 267 if (actions & _UA_SEARCH_PHASE) { 263 LIB_DEBUG_PRINT_SAFE(" lookup phase"); 264 } 268 printf(" lookup phase"); 269 } 270 // DEBUG 265 271 else if (actions & _UA_CLEANUP_PHASE) { 266 LIB_DEBUG_PRINT_SAFE(" cleanup phase");272 printf(" cleanup phase"); 267 273 } 268 274 // Just in case, probably can't actually happen … … 300 306 // Have we reach the correct frame info yet? 301 307 if( lsd_info.Start + callsite_start + callsite_len < instruction_ptr ) { 302 #ifdef __CFA_DEBUG_PRINT__ 308 //DEBUG BEGIN 303 309 void * ls = (void*)lsd_info.Start; 304 310 void * cs = (void*)callsite_start; … … 307 313 void * ep = (void*)lsd_info.Start + callsite_start + callsite_len; 308 314 void * ip = (void*)instruction_ptr; 309 LIB_DEBUG_PRINT_SAFE("\nfound %p - %p (%p, %p, %p), looking for %p\n", bp, ep, ls, cs, cl, ip);310 #endif // __CFA_DEBUG_PRINT__ 315 printf("\nfound %p - %p (%p, %p, %p), looking for %p\n", bp, ep, ls, cs, cl, ip); 316 //DEBUG END 311 317 continue; 312 318 } … … 356 362 357 363 // Based on the return value, check if we matched the exception 358 if( ret == _URC_HANDLER_FOUND) { 359 LIB_DEBUG_PRINT_SAFE(" handler found\n"); 360 } else { 361 LIB_DEBUG_PRINT_SAFE(" no handler\n"); 362 } 364 if( ret == _URC_HANDLER_FOUND) printf(" handler found\n"); 365 else printf(" no handler\n"); 363 366 return ret; 364 367 } 365 368 366 369 // This is only a cleanup handler, ignore it 367 LIB_DEBUG_PRINT_SAFE(" no action");370 printf(" no action"); 368 371 } 369 372 else if (actions & _UA_CLEANUP_PHASE) { … … 385 388 _Unwind_SetIP( context, ((lsd_info.LPStart) + (callsite_landing_pad)) ); 386 389 387 LIB_DEBUG_PRINT_SAFE(" action\n"); 390 // DEBUG 391 printf(" action\n"); 388 392 389 393 // Return have some action to run … … 393 397 394 398 // Nothing to do, move along 395 LIB_DEBUG_PRINT_SAFE(" no landing pad");399 printf(" no landing pad"); 396 400 } 397 401 // No handling found 398 LIB_DEBUG_PRINT_SAFE(" table end reached\n"); 399 402 printf(" table end reached\n"); 403 404 // DEBUG 400 405 UNWIND: 401 LIB_DEBUG_PRINT_SAFE(" unwind\n");406 printf(" unwind\n"); 402 407 403 408 // Keep unwinding the stack
Note:
See TracChangeset
for help on using the changeset viewer.