this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Working C++ exceptions

+31 -28
+5 -4
src/dyld/public.cpp
··· 158 158 if (cbdata->info->dwarf_section) // we already have a match 159 159 return 0; 160 160 161 - std::cout << "Looking into " << info->dlpi_name << std::endl; 161 + //std::cout << "Looking into " << info->dlpi_name << std::endl; 162 162 163 163 if (size < offsetof(struct dl_phdr_info, dlpi_phnum)) 164 164 return 0; ··· 166 166 for (int i = 0; i < info->dlpi_phnum; i++) 167 167 { 168 168 const ElfW(Phdr)* phdr = &info->dlpi_phdr[i]; 169 - 169 + /* 170 170 if (strstr(info->dlpi_name, "cxxdarwin")) 171 171 { 172 172 std::cout << "type: " << phdr->p_type << "; vaddr: " << phdr->p_vaddr << std::endl; 173 173 } 174 + */ 174 175 175 176 if (phdr->p_type == PT_LOAD) 176 177 { ··· 184 185 } 185 186 else if (phdr->p_type == PT_GNU_EH_FRAME) 186 187 { 187 - std::cout << "Found .eh_frame_hdr in " << info->dlpi_name << std::endl; 188 + //std::cout << "Found .eh_frame_hdr in " << info->dlpi_name << std::endl; 188 189 ehdr = (eh_frame_hdr*) (uintptr_t(info->dlpi_addr) + phdr->p_vaddr); 189 190 // cbdata->info->dwarf_section_length = phdr->p_memsz; 190 191 } ··· 192 193 193 194 if (addrMatch && ehdr) 194 195 { 195 - std::cout << "*** Match found! " << info->dlpi_name << std::endl; 196 + //std::cout << "*** Match found! " << info->dlpi_name << std::endl; 196 197 197 198 // Now we find .eh_frame from .eh_frame_hdr 198 199 if (ehdr->version != 1)
+2 -1
src/libcxxdarwin/src-cxxabi/cxa_personality.cpp
··· 833 833 Else a cleanup is not found: return _URC_CONTINUE_UNWIND 834 834 */ 835 835 836 + extern "C" 836 837 _Unwind_Reason_Code 837 838 #if __arm__ 838 839 __gxx_personality_sj0 839 840 #else 840 - __gxx_personality_v0 841 + __darwin___gxx_personality_v0 841 842 #endif 842 843 (int version, _Unwind_Action actions, uint64_t exceptionClass, 843 844 _Unwind_Exception* unwind_exception, _Unwind_Context* context)
+9 -9
src/libcxxdarwin/src-unwind/DwarfParser.hpp
··· 212 212 template <typename A> 213 213 bool CFI_Parser<A>::findFDE(A& addressSpace, pint_t pc, pint_t ehSectionStart, uint32_t sectionLength, pint_t fdeHint, FDE_Info* fdeInfo, CIE_Info* cieInfo) 214 214 { 215 - fprintf(stderr, "findFDE(0x%llX)\n", (long long)pc); 215 + //fprintf(stderr, "findFDE(0x%llX)\n", (long long)pc); 216 216 pint_t p = (fdeHint != 0) ? fdeHint : ehSectionStart; 217 217 const pint_t ehSectionEnd = p + sectionLength; 218 218 while ( p < ehSectionEnd ) { 219 219 pint_t currentCFI = p; 220 - fprintf(stderr, "findFDE() CFI at 0x%llX\n", (long long)p); 220 + //fprintf(stderr, "findFDE() CFI at 0x%llX\n", (long long)p); 221 221 uint64_t cfiLength = addressSpace.get32(p); 222 222 p += 4; 223 223 if ( cfiLength == 0xffffffff ) { ··· 244 244 // parse pc begin and range 245 245 pint_t pcStart = addressSpace.getEncodedP(p, nextCFI, cieInfo->pointerEncoding); 246 246 pint_t pcRange = addressSpace.getEncodedP(p, nextCFI, cieInfo->pointerEncoding & 0x0F); 247 - fprintf(stderr, "FDE with pcRange [0x%08llX, 0x%08llX)\n",(uint64_t)pcStart, (uint64_t)(pcStart+pcRange)); 247 + //fprintf(stderr, "FDE with pcRange [0x%08llX, 0x%08llX)\n",(uint64_t)pcStart, (uint64_t)(pcStart+pcRange)); 248 248 // test if pc is within the function this FDE covers 249 249 if ( (pcStart < pc) && (pc <= pcStart+pcRange) ) { 250 250 // parse rest of info ··· 269 269 fdeInfo->fdeInstructions = p; 270 270 fdeInfo->pcStart = pcStart; 271 271 fdeInfo->pcEnd = pcStart+pcRange; 272 - fprintf(stderr, "findFDE(pc=0x%llX) found with pcRange [0x%08llX, 0x%08llX)\n",(uint64_t)pc, (uint64_t)pcStart, (uint64_t)(pcStart+pcRange)); 272 + //fprintf(stderr, "findFDE(pc=0x%llX) found with pcRange [0x%08llX, 0x%08llX)\n",(uint64_t)pc, (uint64_t)pcStart, (uint64_t)(pcStart+pcRange)); 273 273 return true; 274 274 } 275 275 else { 276 - fprintf(stderr, "findFDE(pc=0x%llX) not found with pcRange [0x%08llX, 0x%08llX)\n",(uint64_t)pc, (uint64_t)pcStart, (uint64_t)(pcStart+pcRange)); 276 + //fprintf(stderr, "findFDE(pc=0x%llX) not found with pcRange [0x%08llX, 0x%08llX)\n",(uint64_t)pc, (uint64_t)pcStart, (uint64_t)(pcStart+pcRange)); 277 277 // pc is not in begin/range, skip this FDE 278 278 } 279 279 } 280 280 else { 281 281 // malformed CIE, now augmentation describing pc range encoding 282 - fprintf(stderr, "malformed CIE\n"); 282 + //fprintf(stderr, "malformed CIE\n"); 283 283 } 284 284 } 285 285 else { 286 286 // malformed FDE. CIE is bad 287 - fprintf(stderr, "malformed FDE, cieStart=0x%llX, ehSectionStart=0x%llX, ehSectionEnd=0x%llX\n", 288 - (uint64_t)cieStart, (uint64_t)ehSectionStart, (uint64_t)ehSectionEnd); 287 + //fprintf(stderr, "malformed FDE, cieStart=0x%llX, ehSectionStart=0x%llX, ehSectionEnd=0x%llX\n", 288 + // (uint64_t)cieStart, (uint64_t)ehSectionStart, (uint64_t)ehSectionEnd); 289 289 } 290 290 p = nextCFI; 291 291 } 292 292 } 293 - fprintf(stderr, "findFDE(pc=0x%llX) not found\n",(uint64_t)pc); 293 + //fprintf(stderr, "findFDE(pc=0x%llX) not found\n",(uint64_t)pc); 294 294 return false; 295 295 } 296 296
+4 -4
src/libcxxdarwin/src-unwind/UnwindCursor.hpp
··· 488 488 if ( !foundFDE ) { 489 489 // otherwise, search cache of previously found FDEs 490 490 pint_t cachedFDE = DwarfFDECache<A>::findFDE(mh, pc); 491 - fprintf(stderr, "getInfoFromDwarfSection(pc=0x%llX) cachedFDE=0x%llX\n", (uint64_t)pc, (uint64_t)cachedFDE); 491 + //fprintf(stderr, "getInfoFromDwarfSection(pc=0x%llX) cachedFDE=0x%llX\n", (uint64_t)pc, (uint64_t)cachedFDE); 492 492 if ( cachedFDE != 0 ) { 493 493 foundFDE = CFI_Parser<A>::findFDE(fAddressSpace, pc, ehSectionStart, sectionLength, cachedFDE, &fdeInfo, &cieInfo); 494 494 foundInCache = foundFDE; 495 - fprintf(stderr, "cachedFDE=0x%llX, foundInCache=%d\n", (uint64_t)cachedFDE, foundInCache); 495 + //fprintf(stderr, "cachedFDE=0x%llX, foundInCache=%d\n", (uint64_t)cachedFDE, foundInCache); 496 496 } 497 497 } 498 498 #endif ··· 516 516 fInfo.extra = (unw_word_t)mh; 517 517 if ( !foundInCache && (sectionOffsetOfFDE == 0) ) { 518 518 // don't add to cache entries the compact encoding table can find quickly 519 - fprintf(stderr, "getInfoFromDwarfSection(pc=0x%0llX), mh=0x%llX, start_ip=0x%0llX, fde=0x%0llX, personality=0x%0llX\n", 520 - (uint64_t)pc, (uint64_t)mh, fInfo.start_ip, fInfo.unwind_info, fInfo.handler); 519 + //fprintf(stderr, "getInfoFromDwarfSection(pc=0x%0llX), mh=0x%llX, start_ip=0x%0llX, fde=0x%0llX, personality=0x%0llX\n", 520 + // (uint64_t)pc, (uint64_t)mh, fInfo.start_ip, fInfo.unwind_info, fInfo.handler); 521 521 #if !FOR_DYLD 522 522 DwarfFDECache<A>::add(mh, fdeInfo.pcStart, fdeInfo.pcEnd, fdeInfo.fdeStart); 523 523 #endif
+11 -10
src/libcxxdarwin/src-unwind/UnwindLevel1.c
··· 34 34 #include <stdio.h> 35 35 #include <string.h> 36 36 #include <execinfo.h> 37 + #include <dlfcn.h> 37 38 38 39 #include "libunwind.h" 39 40 #include "unwind.h" 40 41 #include "InternalMacros.h" 41 42 42 - extern void* __gxx_personality_v0; 43 + void* __darwin___gxx_personality_v0(); 44 + void* __gxx_personality_v0(); 43 45 44 46 #if __ppc__ || __i386__ || __x86_64__ 45 47 ··· 90 92 __personality_routine p = (__personality_routine)(long)(frameInfo.handler); 91 93 _Unwind_Reason_Code personalityResult; 92 94 93 - if (((long)p) == 0x432080) 94 - personalityResult = _URC_CONTINUE_UNWIND; 95 - else 96 - { 95 + if (p == dlsym(0, "__gxx_personality_v0")) 96 + p = __darwin___gxx_personality_v0; 97 97 98 - DEBUG_PRINT_UNWINDING("unwind_phase1(ex_ojb=%p): calling personality function %p\n", exception_object, p); 99 - personalityResult = (*p)(1, _UA_SEARCH_PHASE, 100 - exception_object->exception_class, exception_object, 101 - (struct _Unwind_Context*)(&cursor1)); 102 - } 98 + DEBUG_PRINT_UNWINDING("unwind_phase1(ex_ojb=%p): calling personality function %p\n", exception_object, p); 99 + personalityResult = (*p)(1, _UA_SEARCH_PHASE, 100 + exception_object->exception_class, exception_object, 101 + (struct _Unwind_Context*)(&cursor1)); 103 102 104 103 switch ( personalityResult ) { 105 104 case _URC_HANDLER_FOUND: ··· 170 169 // if there is a personality routine, tell it we are unwinding 171 170 if ( frameInfo.handler != 0 ) { 172 171 __personality_routine p = (__personality_routine)(long)(frameInfo.handler); 172 + if (p == dlsym(0, "__gxx_personality_v0")) 173 + p = __darwin___gxx_personality_v0; 173 174 _Unwind_Action action = _UA_CLEANUP_PHASE; 174 175 if ( sp == exception_object->private_2 ) 175 176 action = (_Unwind_Action)(_UA_CLEANUP_PHASE|_UA_HANDLER_FRAME); // tell personality this was the frame it marked in phase 1