Changeset 8135d4c for src/libcfa
- Timestamp:
- Aug 22, 2017, 7:31:52 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 9aaac6e9
- Parents:
- fc56cdbf (diff), b3d413b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/libcfa
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/Makefile.am
rfc56cdbf r8135d4c 36 36 ${AM_V_GEN}@BACKEND_CC@ @CFA_FLAGS@ -D__CFA_DEBUG__ -O0 -c -o $@ $< 37 37 38 EXTRA_FLAGS = -g -Wall -Werror -Wno-unused-function - I${abs_top_srcdir}/src/libcfa/libhdr -imacros libcfa-prelude.c @CFA_FLAGS@38 EXTRA_FLAGS = -g -Wall -Werror -Wno-unused-function -imacros libcfa-prelude.c @CFA_FLAGS@ 39 39 40 40 AM_CCASFLAGS = @CFA_FLAGS@ -
src/libcfa/Makefile.in
rfc56cdbf r8135d4c 416 416 ARFLAGS = cr 417 417 lib_LIBRARIES = $(am__append_1) $(am__append_2) 418 EXTRA_FLAGS = -g -Wall -Werror -Wno-unused-function - I${abs_top_srcdir}/src/libcfa/libhdr -imacros libcfa-prelude.c @CFA_FLAGS@418 EXTRA_FLAGS = -g -Wall -Werror -Wno-unused-function -imacros libcfa-prelude.c @CFA_FLAGS@ 419 419 AM_CCASFLAGS = @CFA_FLAGS@ 420 420 headers = fstream iostream iterator limits rational stdlib \ -
src/libcfa/exception.c
rfc56cdbf r8135d4c 10 10 // Created On : Mon Jun 26 15:13:00 2017 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Aug 4 15:20:00 201713 // Update Count : 612 // Last Modified On : Thr Aug 17 15:45:00 2017 13 // Update Count : 7 14 14 // 15 15 … … 23 23 #include <stdio.h> 24 24 #include <unwind.h> 25 #include <libhdr/libdebug.h> 25 26 26 27 // FIX ME: temporary hack to keep ARM build working … … 79 80 void __cfaehm__throw_resume(exception * except) { 80 81 81 // DEBUG 82 printf("Throwing resumption exception\n"); 82 LIB_DEBUG_PRINT_SAFE("Throwing resumption exception\n"); 83 83 84 84 struct __cfaehm__try_resume_node * original_head = shared_stack.current_resume; … … 94 94 } 95 95 96 printf("Unhandled exception\n");96 LIB_DEBUG_PRINT_SAFE("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 int(*handler)(exception * except)) {108 _Bool (*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 // DEBUG 157 printf( "Deleting Exception\n"); 156 LIB_DEBUG_PRINT_SAFE("Deleting Exception\n"); 158 157 159 158 // Remove the exception from the list. … … 235 234 236 235 void __cfaehm__throw_terminate( exception * val ) { 237 // DEBUG 238 printf("Throwing termination exception\n"); 236 LIB_DEBUG_PRINT_SAFE("Throwing termination exception\n"); 239 237 240 238 __cfaehm__allocate_exception( val ); … … 243 241 244 242 void __cfaehm__rethrow_terminate(void) { 245 // DEBUG 246 printf("Rethrowing termination exception\n"); 243 LIB_DEBUG_PRINT_SAFE("Rethrowing termination exception\n"); 247 244 248 245 __cfaehm__begin_unwind(); … … 257 254 { 258 255 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); 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); 262 258 263 259 // If we've reached the end of the stack then there is nothing much we can do... 264 260 if( actions & _UA_END_OF_STACK ) return _URC_END_OF_STACK; 265 261 266 // DEBUG267 262 if (actions & _UA_SEARCH_PHASE) { 268 printf(" lookup phase"); 269 } 270 // DEBUG 263 LIB_DEBUG_PRINT_SAFE(" lookup phase"); 264 } 271 265 else if (actions & _UA_CLEANUP_PHASE) { 272 printf(" cleanup phase");266 LIB_DEBUG_PRINT_SAFE(" cleanup phase"); 273 267 } 274 268 // Just in case, probably can't actually happen … … 306 300 // Have we reach the correct frame info yet? 307 301 if( lsd_info.Start + callsite_start + callsite_len < instruction_ptr ) { 308 //DEBUG BEGIN 302 #ifdef __CFA_DEBUG_PRINT__ 309 303 void * ls = (void*)lsd_info.Start; 310 304 void * cs = (void*)callsite_start; … … 313 307 void * ep = (void*)lsd_info.Start + callsite_start + callsite_len; 314 308 void * ip = (void*)instruction_ptr; 315 printf("\nfound %p - %p (%p, %p, %p), looking for %p\n", bp, ep, ls, cs, cl, ip);316 //DEBUG END 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__ 317 311 continue; 318 312 } … … 362 356 363 357 // Based on the return value, check if we matched the exception 364 if( ret == _URC_HANDLER_FOUND) printf(" handler found\n"); 365 else printf(" no handler\n"); 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 } 366 363 return ret; 367 364 } 368 365 369 366 // This is only a cleanup handler, ignore it 370 printf(" no action");367 LIB_DEBUG_PRINT_SAFE(" no action"); 371 368 } 372 369 else if (actions & _UA_CLEANUP_PHASE) { … … 388 385 _Unwind_SetIP( context, ((lsd_info.LPStart) + (callsite_landing_pad)) ); 389 386 390 // DEBUG 391 printf(" action\n"); 387 LIB_DEBUG_PRINT_SAFE(" action\n"); 392 388 393 389 // Return have some action to run … … 397 393 398 394 // Nothing to do, move along 399 printf(" no landing pad");395 LIB_DEBUG_PRINT_SAFE(" no landing pad"); 400 396 } 401 397 // No handling found 402 printf(" table end reached\n"); 403 404 // DEBUG 398 LIB_DEBUG_PRINT_SAFE(" table end reached\n"); 399 405 400 UNWIND: 406 printf(" unwind\n");401 LIB_DEBUG_PRINT_SAFE(" unwind\n"); 407 402 408 403 // Keep unwinding the stack -
src/libcfa/exception.h
rfc56cdbf r8135d4c 10 10 // Created On : Mon Jun 26 15:11:00 2017 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Aug 4 15:20:00 201713 // Update Count : 512 // Last Modified On : Thr Aug 17 15:44:00 2017 13 // Update Count : 6 14 14 // 15 15 … … 55 55 struct __cfaehm__try_resume_node { 56 56 struct __cfaehm__try_resume_node * next; 57 int(*handler)(exception * except);57 _Bool (*handler)(exception * except); 58 58 }; 59 59 … … 61 61 void __cfaehm__try_resume_setup( 62 62 struct __cfaehm__try_resume_node * node, 63 int(*handler)(exception * except));63 _Bool (*handler)(exception * except)); 64 64 void __cfaehm__try_resume_cleanup( 65 65 struct __cfaehm__try_resume_node * node); -
src/libcfa/libhdr.h
rfc56cdbf r8135d4c 16 16 #pragma once 17 17 18 #include "lib align.h"19 #include "lib debug.h"20 #include "lib tools.h"18 #include "libhdr/libalign.h" 19 #include "libhdr/libdebug.h" 20 #include "libhdr/libtools.h" 21 21 22 22 // Local Variables: //
Note: See TracChangeset
for help on using the changeset viewer.