Deleted Added
full compact
Unwind-EHABI.cpp (303521) Unwind-EHABI.cpp (308006)
1//===--------------------------- Unwind-EHABI.cpp -------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//

--- 440 unchanged lines hidden (view full) ---

449
450 // Walk each frame looking for a place to stop.
451 for (bool handlerNotFound = true; handlerNotFound;) {
452
453 // See if frame has code to run (has personality routine).
454 unw_proc_info_t frameInfo;
455 if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
456 _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_get_proc_info "
1//===--------------------------- Unwind-EHABI.cpp -------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//

--- 440 unchanged lines hidden (view full) ---

449
450 // Walk each frame looking for a place to stop.
451 for (bool handlerNotFound = true; handlerNotFound;) {
452
453 // See if frame has code to run (has personality routine).
454 unw_proc_info_t frameInfo;
455 if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
456 _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_get_proc_info "
457 "failed => _URC_FATAL_PHASE1_ERROR\n",
457 "failed => _URC_FATAL_PHASE1_ERROR",
458 static_cast<void *>(exception_object));
459 return _URC_FATAL_PHASE1_ERROR;
460 }
461
462 // When tracing, print state information.
463 if (_LIBUNWIND_TRACING_UNWINDING) {
464 char functionBuf[512];
465 const char *functionName = functionBuf;
466 unw_word_t offset;
467 if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
468 &offset) != UNW_ESUCCESS) ||
469 (frameInfo.start_ip + offset > frameInfo.end_ip))
470 functionName = ".anonymous.";
471 unw_word_t pc;
472 unw_get_reg(cursor, UNW_REG_IP, &pc);
473 _LIBUNWIND_TRACE_UNWINDING(
474 "unwind_phase1(ex_ojb=%p): pc=0x%llX, start_ip=0x%llX, func=%s, "
458 static_cast<void *>(exception_object));
459 return _URC_FATAL_PHASE1_ERROR;
460 }
461
462 // When tracing, print state information.
463 if (_LIBUNWIND_TRACING_UNWINDING) {
464 char functionBuf[512];
465 const char *functionName = functionBuf;
466 unw_word_t offset;
467 if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
468 &offset) != UNW_ESUCCESS) ||
469 (frameInfo.start_ip + offset > frameInfo.end_ip))
470 functionName = ".anonymous.";
471 unw_word_t pc;
472 unw_get_reg(cursor, UNW_REG_IP, &pc);
473 _LIBUNWIND_TRACE_UNWINDING(
474 "unwind_phase1(ex_ojb=%p): pc=0x%llX, start_ip=0x%llX, func=%s, "
475 "lsda=0x%llX, personality=0x%llX\n",
475 "lsda=0x%llX, personality=0x%llX",
476 static_cast<void *>(exception_object), (long long)pc,
477 (long long)frameInfo.start_ip, functionName,
478 (long long)frameInfo.lsda, (long long)frameInfo.handler);
479 }
480
481 // If there is a personality routine, ask it if it will want to stop at
482 // this frame.
483 if (frameInfo.handler != 0) {
484 __personality_routine p =
485 (__personality_routine)(long)(frameInfo.handler);
486 _LIBUNWIND_TRACE_UNWINDING(
476 static_cast<void *>(exception_object), (long long)pc,
477 (long long)frameInfo.start_ip, functionName,
478 (long long)frameInfo.lsda, (long long)frameInfo.handler);
479 }
480
481 // If there is a personality routine, ask it if it will want to stop at
482 // this frame.
483 if (frameInfo.handler != 0) {
484 __personality_routine p =
485 (__personality_routine)(long)(frameInfo.handler);
486 _LIBUNWIND_TRACE_UNWINDING(
487 "unwind_phase1(ex_ojb=%p): calling personality function %p\n",
487 "unwind_phase1(ex_ojb=%p): calling personality function %p",
488 static_cast<void *>(exception_object),
489 reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(p)));
490 struct _Unwind_Context *context = (struct _Unwind_Context *)(cursor);
491 exception_object->pr_cache.fnstart = frameInfo.start_ip;
492 exception_object->pr_cache.ehtp =
493 (_Unwind_EHT_Header *)frameInfo.unwind_info;
494 exception_object->pr_cache.additional = frameInfo.flags;
495 _Unwind_Reason_Code personalityResult =
496 (*p)(_US_VIRTUAL_UNWIND_FRAME, exception_object, context);
497 _LIBUNWIND_TRACE_UNWINDING(
498 "unwind_phase1(ex_ojb=%p): personality result %d start_ip %x ehtp %p "
488 static_cast<void *>(exception_object),
489 reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(p)));
490 struct _Unwind_Context *context = (struct _Unwind_Context *)(cursor);
491 exception_object->pr_cache.fnstart = frameInfo.start_ip;
492 exception_object->pr_cache.ehtp =
493 (_Unwind_EHT_Header *)frameInfo.unwind_info;
494 exception_object->pr_cache.additional = frameInfo.flags;
495 _Unwind_Reason_Code personalityResult =
496 (*p)(_US_VIRTUAL_UNWIND_FRAME, exception_object, context);
497 _LIBUNWIND_TRACE_UNWINDING(
498 "unwind_phase1(ex_ojb=%p): personality result %d start_ip %x ehtp %p "
499 "additional %x\n",
499 "additional %x",
500 static_cast<void *>(exception_object), personalityResult,
501 exception_object->pr_cache.fnstart,
502 static_cast<void *>(exception_object->pr_cache.ehtp),
503 exception_object->pr_cache.additional);
504 switch (personalityResult) {
505 case _URC_HANDLER_FOUND:
506 // found a catch clause or locals that need destructing in this frame
507 // stop search and remember stack pointer at the frame
508 handlerNotFound = false;
509 // p should have initialized barrier_cache. EHABI #7.3.5
510 _LIBUNWIND_TRACE_UNWINDING(
500 static_cast<void *>(exception_object), personalityResult,
501 exception_object->pr_cache.fnstart,
502 static_cast<void *>(exception_object->pr_cache.ehtp),
503 exception_object->pr_cache.additional);
504 switch (personalityResult) {
505 case _URC_HANDLER_FOUND:
506 // found a catch clause or locals that need destructing in this frame
507 // stop search and remember stack pointer at the frame
508 handlerNotFound = false;
509 // p should have initialized barrier_cache. EHABI #7.3.5
510 _LIBUNWIND_TRACE_UNWINDING(
511 "unwind_phase1(ex_ojb=%p): _URC_HANDLER_FOUND \n",
511 "unwind_phase1(ex_ojb=%p): _URC_HANDLER_FOUND",
512 static_cast<void *>(exception_object));
513 return _URC_NO_REASON;
514
515 case _URC_CONTINUE_UNWIND:
516 _LIBUNWIND_TRACE_UNWINDING(
512 static_cast<void *>(exception_object));
513 return _URC_NO_REASON;
514
515 case _URC_CONTINUE_UNWIND:
516 _LIBUNWIND_TRACE_UNWINDING(
517 "unwind_phase1(ex_ojb=%p): _URC_CONTINUE_UNWIND\n",
517 "unwind_phase1(ex_ojb=%p): _URC_CONTINUE_UNWIND",
518 static_cast<void *>(exception_object));
519 // continue unwinding
520 break;
521
522 // EHABI #7.3.3
523 case _URC_FAILURE:
524 return _URC_FAILURE;
525
526 default:
527 // something went wrong
528 _LIBUNWIND_TRACE_UNWINDING(
518 static_cast<void *>(exception_object));
519 // continue unwinding
520 break;
521
522 // EHABI #7.3.3
523 case _URC_FAILURE:
524 return _URC_FAILURE;
525
526 default:
527 // something went wrong
528 _LIBUNWIND_TRACE_UNWINDING(
529 "unwind_phase1(ex_ojb=%p): _URC_FATAL_PHASE1_ERROR\n",
529 "unwind_phase1(ex_ojb=%p): _URC_FATAL_PHASE1_ERROR",
530 static_cast<void *>(exception_object));
531 return _URC_FATAL_PHASE1_ERROR;
532 }
533 }
534 }
535 return _URC_NO_REASON;
536}
537
538static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor,
539 _Unwind_Exception *exception_object,
540 bool resume) {
541 // See comment at the start of unwind_phase1 regarding VRS integrity.
542 unw_init_local(cursor, uc);
543
530 static_cast<void *>(exception_object));
531 return _URC_FATAL_PHASE1_ERROR;
532 }
533 }
534 }
535 return _URC_NO_REASON;
536}
537
538static _Unwind_Reason_Code unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor,
539 _Unwind_Exception *exception_object,
540 bool resume) {
541 // See comment at the start of unwind_phase1 regarding VRS integrity.
542 unw_init_local(cursor, uc);
543
544 _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)\n",
544 _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)",
545 static_cast<void *>(exception_object));
546 int frame_count = 0;
547
548 // Walk each frame until we reach where search phase said to stop.
549 while (true) {
545 static_cast<void *>(exception_object));
546 int frame_count = 0;
547
548 // Walk each frame until we reach where search phase said to stop.
549 while (true) {
550 // Ask libuwind to get next frame (skip over first which is
550 // Ask libunwind to get next frame (skip over first which is
551 // _Unwind_RaiseException or _Unwind_Resume).
552 //
553 // Resume only ever makes sense for 1 frame.
554 _Unwind_State state =
555 resume ? _US_UNWIND_FRAME_RESUME : _US_UNWIND_FRAME_STARTING;
556 if (resume && frame_count == 1) {
557 // On a resume, first unwind the _Unwind_Resume() frame. The next frame
558 // is now the landing pad for the cleanup from a previous execution of

--- 8 unchanged lines hidden (view full) ---

567 }
568
569 // Get info about this frame.
570 unw_word_t sp;
571 unw_proc_info_t frameInfo;
572 unw_get_reg(cursor, UNW_REG_SP, &sp);
573 if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
574 _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_get_proc_info "
551 // _Unwind_RaiseException or _Unwind_Resume).
552 //
553 // Resume only ever makes sense for 1 frame.
554 _Unwind_State state =
555 resume ? _US_UNWIND_FRAME_RESUME : _US_UNWIND_FRAME_STARTING;
556 if (resume && frame_count == 1) {
557 // On a resume, first unwind the _Unwind_Resume() frame. The next frame
558 // is now the landing pad for the cleanup from a previous execution of

--- 8 unchanged lines hidden (view full) ---

567 }
568
569 // Get info about this frame.
570 unw_word_t sp;
571 unw_proc_info_t frameInfo;
572 unw_get_reg(cursor, UNW_REG_SP, &sp);
573 if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) {
574 _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_get_proc_info "
575 "failed => _URC_FATAL_PHASE2_ERROR\n",
575 "failed => _URC_FATAL_PHASE2_ERROR",
576 static_cast<void *>(exception_object));
577 return _URC_FATAL_PHASE2_ERROR;
578 }
579
580 // When tracing, print state information.
581 if (_LIBUNWIND_TRACING_UNWINDING) {
582 char functionBuf[512];
583 const char *functionName = functionBuf;
584 unw_word_t offset;
585 if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
586 &offset) != UNW_ESUCCESS) ||
587 (frameInfo.start_ip + offset > frameInfo.end_ip))
588 functionName = ".anonymous.";
589 _LIBUNWIND_TRACE_UNWINDING(
590 "unwind_phase2(ex_ojb=%p): start_ip=0x%llX, func=%s, sp=0x%llX, "
576 static_cast<void *>(exception_object));
577 return _URC_FATAL_PHASE2_ERROR;
578 }
579
580 // When tracing, print state information.
581 if (_LIBUNWIND_TRACING_UNWINDING) {
582 char functionBuf[512];
583 const char *functionName = functionBuf;
584 unw_word_t offset;
585 if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf),
586 &offset) != UNW_ESUCCESS) ||
587 (frameInfo.start_ip + offset > frameInfo.end_ip))
588 functionName = ".anonymous.";
589 _LIBUNWIND_TRACE_UNWINDING(
590 "unwind_phase2(ex_ojb=%p): start_ip=0x%llX, func=%s, sp=0x%llX, "
591 "lsda=0x%llX, personality=0x%llX\n",
591 "lsda=0x%llX, personality=0x%llX",
592 static_cast<void *>(exception_object), (long long)frameInfo.start_ip,
593 functionName, (long long)sp, (long long)frameInfo.lsda,
594 (long long)frameInfo.handler);
595 }
596
597 // If there is a personality routine, tell it we are unwinding.
598 if (frameInfo.handler != 0) {
599 __personality_routine p =

--- 5 unchanged lines hidden (view full) ---

605 (_Unwind_EHT_Header *)frameInfo.unwind_info;
606 exception_object->pr_cache.additional = frameInfo.flags;
607 _Unwind_Reason_Code personalityResult =
608 (*p)(state, exception_object, context);
609 switch (personalityResult) {
610 case _URC_CONTINUE_UNWIND:
611 // Continue unwinding
612 _LIBUNWIND_TRACE_UNWINDING(
592 static_cast<void *>(exception_object), (long long)frameInfo.start_ip,
593 functionName, (long long)sp, (long long)frameInfo.lsda,
594 (long long)frameInfo.handler);
595 }
596
597 // If there is a personality routine, tell it we are unwinding.
598 if (frameInfo.handler != 0) {
599 __personality_routine p =

--- 5 unchanged lines hidden (view full) ---

605 (_Unwind_EHT_Header *)frameInfo.unwind_info;
606 exception_object->pr_cache.additional = frameInfo.flags;
607 _Unwind_Reason_Code personalityResult =
608 (*p)(state, exception_object, context);
609 switch (personalityResult) {
610 case _URC_CONTINUE_UNWIND:
611 // Continue unwinding
612 _LIBUNWIND_TRACE_UNWINDING(
613 "unwind_phase2(ex_ojb=%p): _URC_CONTINUE_UNWIND\n",
613 "unwind_phase2(ex_ojb=%p): _URC_CONTINUE_UNWIND",
614 static_cast<void *>(exception_object));
615 // EHABI #7.2
616 if (sp == exception_object->barrier_cache.sp) {
617 // Phase 1 said we would stop at this frame, but we did not...
618 _LIBUNWIND_ABORT("during phase1 personality function said it would "
619 "stop here, but now in phase2 it did not stop here");
620 }
621 break;
622 case _URC_INSTALL_CONTEXT:
623 _LIBUNWIND_TRACE_UNWINDING(
614 static_cast<void *>(exception_object));
615 // EHABI #7.2
616 if (sp == exception_object->barrier_cache.sp) {
617 // Phase 1 said we would stop at this frame, but we did not...
618 _LIBUNWIND_ABORT("during phase1 personality function said it would "
619 "stop here, but now in phase2 it did not stop here");
620 }
621 break;
622 case _URC_INSTALL_CONTEXT:
623 _LIBUNWIND_TRACE_UNWINDING(
624 "unwind_phase2(ex_ojb=%p): _URC_INSTALL_CONTEXT\n",
624 "unwind_phase2(ex_ojb=%p): _URC_INSTALL_CONTEXT",
625 static_cast<void *>(exception_object));
626 // Personality routine says to transfer control to landing pad.
627 // We may get control back if landing pad calls _Unwind_Resume().
628 if (_LIBUNWIND_TRACING_UNWINDING) {
629 unw_word_t pc;
630 unw_get_reg(cursor, UNW_REG_IP, &pc);
631 unw_get_reg(cursor, UNW_REG_SP, &sp);
632 _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): re-entering "
625 static_cast<void *>(exception_object));
626 // Personality routine says to transfer control to landing pad.
627 // We may get control back if landing pad calls _Unwind_Resume().
628 if (_LIBUNWIND_TRACING_UNWINDING) {
629 unw_word_t pc;
630 unw_get_reg(cursor, UNW_REG_IP, &pc);
631 unw_get_reg(cursor, UNW_REG_SP, &sp);
632 _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): re-entering "
633 "user code with ip=0x%llX, sp=0x%llX\n",
633 "user code with ip=0x%llX, sp=0x%llX",
634 static_cast<void *>(exception_object),
635 (long long)pc, (long long)sp);
636 }
637
638 {
639 // EHABI #7.4.1 says we need to preserve pc for when _Unwind_Resume
640 // is called back, to find this same frame.
641 unw_word_t pc;

--- 21 unchanged lines hidden (view full) ---

663 // Clean up phase did not resume at the frame that the search phase
664 // said it would...
665 return _URC_FATAL_PHASE2_ERROR;
666}
667
668/// Called by __cxa_throw. Only returns if there is a fatal error.
669_LIBUNWIND_EXPORT _Unwind_Reason_Code
670_Unwind_RaiseException(_Unwind_Exception *exception_object) {
634 static_cast<void *>(exception_object),
635 (long long)pc, (long long)sp);
636 }
637
638 {
639 // EHABI #7.4.1 says we need to preserve pc for when _Unwind_Resume
640 // is called back, to find this same frame.
641 unw_word_t pc;

--- 21 unchanged lines hidden (view full) ---

663 // Clean up phase did not resume at the frame that the search phase
664 // said it would...
665 return _URC_FATAL_PHASE2_ERROR;
666}
667
668/// Called by __cxa_throw. Only returns if there is a fatal error.
669_LIBUNWIND_EXPORT _Unwind_Reason_Code
670_Unwind_RaiseException(_Unwind_Exception *exception_object) {
671 _LIBUNWIND_TRACE_API("_Unwind_RaiseException(ex_obj=%p)\n",
671 _LIBUNWIND_TRACE_API("_Unwind_RaiseException(ex_obj=%p)",
672 static_cast<void *>(exception_object));
673 unw_context_t uc;
674 unw_cursor_t cursor;
675 unw_getcontext(&uc);
676
677 // This field for is for compatibility with GCC to say this isn't a forced
678 // unwind. EHABI #7.2
679 exception_object->unwinder_cache.reserved1 = 0;

--- 21 unchanged lines hidden (view full) ---

701/// geneated user code. All other _Unwind_* routines are called
702/// by the C++ runtime __cxa_* routines.
703///
704/// Note: re-throwing an exception (as opposed to continuing the unwind)
705/// is implemented by having the code call __cxa_rethrow() which
706/// in turn calls _Unwind_Resume_or_Rethrow().
707_LIBUNWIND_EXPORT void
708_Unwind_Resume(_Unwind_Exception *exception_object) {
672 static_cast<void *>(exception_object));
673 unw_context_t uc;
674 unw_cursor_t cursor;
675 unw_getcontext(&uc);
676
677 // This field for is for compatibility with GCC to say this isn't a forced
678 // unwind. EHABI #7.2
679 exception_object->unwinder_cache.reserved1 = 0;

--- 21 unchanged lines hidden (view full) ---

701/// geneated user code. All other _Unwind_* routines are called
702/// by the C++ runtime __cxa_* routines.
703///
704/// Note: re-throwing an exception (as opposed to continuing the unwind)
705/// is implemented by having the code call __cxa_rethrow() which
706/// in turn calls _Unwind_Resume_or_Rethrow().
707_LIBUNWIND_EXPORT void
708_Unwind_Resume(_Unwind_Exception *exception_object) {
709 _LIBUNWIND_TRACE_API("_Unwind_Resume(ex_obj=%p)\n",
709 _LIBUNWIND_TRACE_API("_Unwind_Resume(ex_obj=%p)",
710 static_cast<void *>(exception_object));
711 unw_context_t uc;
712 unw_cursor_t cursor;
713 unw_getcontext(&uc);
714
715 // _Unwind_RaiseException on EHABI will always set the reserved1 field to 0,
716 // which is in the same position as private_1 below.
717 // TODO(ajwong): Who wronte the above? Why is it true?

--- 7 unchanged lines hidden (view full) ---

725_LIBUNWIND_EXPORT uintptr_t
726_Unwind_GetLanguageSpecificData(struct _Unwind_Context *context) {
727 unw_cursor_t *cursor = (unw_cursor_t *)context;
728 unw_proc_info_t frameInfo;
729 uintptr_t result = 0;
730 if (unw_get_proc_info(cursor, &frameInfo) == UNW_ESUCCESS)
731 result = (uintptr_t)frameInfo.lsda;
732 _LIBUNWIND_TRACE_API(
710 static_cast<void *>(exception_object));
711 unw_context_t uc;
712 unw_cursor_t cursor;
713 unw_getcontext(&uc);
714
715 // _Unwind_RaiseException on EHABI will always set the reserved1 field to 0,
716 // which is in the same position as private_1 below.
717 // TODO(ajwong): Who wronte the above? Why is it true?

--- 7 unchanged lines hidden (view full) ---

725_LIBUNWIND_EXPORT uintptr_t
726_Unwind_GetLanguageSpecificData(struct _Unwind_Context *context) {
727 unw_cursor_t *cursor = (unw_cursor_t *)context;
728 unw_proc_info_t frameInfo;
729 uintptr_t result = 0;
730 if (unw_get_proc_info(cursor, &frameInfo) == UNW_ESUCCESS)
731 result = (uintptr_t)frameInfo.lsda;
732 _LIBUNWIND_TRACE_API(
733 "_Unwind_GetLanguageSpecificData(context=%p) => 0x%llx\n",
733 "_Unwind_GetLanguageSpecificData(context=%p) => 0x%llx",
734 static_cast<void *>(context), (long long)result);
735 return result;
736}
737
738static uint64_t ValueAsBitPattern(_Unwind_VRS_DataRepresentation representation,
739 void* valuep) {
740 uint64_t value = 0;
741 switch (representation) {

--- 11 unchanged lines hidden (view full) ---

753 return value;
754}
755
756_Unwind_VRS_Result
757_Unwind_VRS_Set(_Unwind_Context *context, _Unwind_VRS_RegClass regclass,
758 uint32_t regno, _Unwind_VRS_DataRepresentation representation,
759 void *valuep) {
760 _LIBUNWIND_TRACE_API("_Unwind_VRS_Set(context=%p, regclass=%d, reg=%d, "
734 static_cast<void *>(context), (long long)result);
735 return result;
736}
737
738static uint64_t ValueAsBitPattern(_Unwind_VRS_DataRepresentation representation,
739 void* valuep) {
740 uint64_t value = 0;
741 switch (representation) {

--- 11 unchanged lines hidden (view full) ---

753 return value;
754}
755
756_Unwind_VRS_Result
757_Unwind_VRS_Set(_Unwind_Context *context, _Unwind_VRS_RegClass regclass,
758 uint32_t regno, _Unwind_VRS_DataRepresentation representation,
759 void *valuep) {
760 _LIBUNWIND_TRACE_API("_Unwind_VRS_Set(context=%p, regclass=%d, reg=%d, "
761 "rep=%d, value=0x%llX)\n",
761 "rep=%d, value=0x%llX)",
762 static_cast<void *>(context), regclass, regno,
763 representation,
764 ValueAsBitPattern(representation, valuep));
765 unw_cursor_t *cursor = (unw_cursor_t *)context;
766 switch (regclass) {
767 case _UVRSC_CORE:
768 if (representation != _UVRSD_UINT32 || regno > 15)
769 return _UVRSR_FAILED;

--- 88 unchanged lines hidden (view full) ---

858 _Unwind_VRS_RegClass regclass,
859 uint32_t regno,
860 _Unwind_VRS_DataRepresentation representation,
861 void *valuep) {
862 _Unwind_VRS_Result result =
863 _Unwind_VRS_Get_Internal(context, regclass, regno, representation,
864 valuep);
865 _LIBUNWIND_TRACE_API("_Unwind_VRS_Get(context=%p, regclass=%d, reg=%d, "
762 static_cast<void *>(context), regclass, regno,
763 representation,
764 ValueAsBitPattern(representation, valuep));
765 unw_cursor_t *cursor = (unw_cursor_t *)context;
766 switch (regclass) {
767 case _UVRSC_CORE:
768 if (representation != _UVRSD_UINT32 || regno > 15)
769 return _UVRSR_FAILED;

--- 88 unchanged lines hidden (view full) ---

858 _Unwind_VRS_RegClass regclass,
859 uint32_t regno,
860 _Unwind_VRS_DataRepresentation representation,
861 void *valuep) {
862 _Unwind_VRS_Result result =
863 _Unwind_VRS_Get_Internal(context, regclass, regno, representation,
864 valuep);
865 _LIBUNWIND_TRACE_API("_Unwind_VRS_Get(context=%p, regclass=%d, reg=%d, "
866 "rep=%d, value=0x%llX, result = %d)\n",
866 "rep=%d, value=0x%llX, result = %d)",
867 static_cast<void *>(context), regclass, regno,
868 representation,
869 ValueAsBitPattern(representation, valuep), result);
870 return result;
871}
872
873_Unwind_VRS_Result
874_Unwind_VRS_Pop(_Unwind_Context *context, _Unwind_VRS_RegClass regclass,
875 uint32_t discriminator,
876 _Unwind_VRS_DataRepresentation representation) {
877 _LIBUNWIND_TRACE_API("_Unwind_VRS_Pop(context=%p, regclass=%d, "
867 static_cast<void *>(context), regclass, regno,
868 representation,
869 ValueAsBitPattern(representation, valuep), result);
870 return result;
871}
872
873_Unwind_VRS_Result
874_Unwind_VRS_Pop(_Unwind_Context *context, _Unwind_VRS_RegClass regclass,
875 uint32_t discriminator,
876 _Unwind_VRS_DataRepresentation representation) {
877 _LIBUNWIND_TRACE_API("_Unwind_VRS_Pop(context=%p, regclass=%d, "
878 "discriminator=%d, representation=%d)\n",
878 "discriminator=%d, representation=%d)",
879 static_cast<void *>(context), regclass, discriminator,
880 representation);
881 switch (regclass) {
882 case _UVRSC_CORE:
883 case _UVRSC_WMMXC: {
884 if (representation != _UVRSD_UINT32)
885 return _UVRSR_FAILED;
886 // When popping SP from the stack, we don't want to override it from the

--- 56 unchanged lines hidden (view full) ---

943/// function.
944_LIBUNWIND_EXPORT uintptr_t
945_Unwind_GetRegionStart(struct _Unwind_Context *context) {
946 unw_cursor_t *cursor = (unw_cursor_t *)context;
947 unw_proc_info_t frameInfo;
948 uintptr_t result = 0;
949 if (unw_get_proc_info(cursor, &frameInfo) == UNW_ESUCCESS)
950 result = (uintptr_t)frameInfo.start_ip;
879 static_cast<void *>(context), regclass, discriminator,
880 representation);
881 switch (regclass) {
882 case _UVRSC_CORE:
883 case _UVRSC_WMMXC: {
884 if (representation != _UVRSD_UINT32)
885 return _UVRSR_FAILED;
886 // When popping SP from the stack, we don't want to override it from the

--- 56 unchanged lines hidden (view full) ---

943/// function.
944_LIBUNWIND_EXPORT uintptr_t
945_Unwind_GetRegionStart(struct _Unwind_Context *context) {
946 unw_cursor_t *cursor = (unw_cursor_t *)context;
947 unw_proc_info_t frameInfo;
948 uintptr_t result = 0;
949 if (unw_get_proc_info(cursor, &frameInfo) == UNW_ESUCCESS)
950 result = (uintptr_t)frameInfo.start_ip;
951 _LIBUNWIND_TRACE_API("_Unwind_GetRegionStart(context=%p) => 0x%llX\n",
951 _LIBUNWIND_TRACE_API("_Unwind_GetRegionStart(context=%p) => 0x%llX",
952 static_cast<void *>(context), (long long)result);
953 return result;
954}
955
956
957/// Called by personality handler during phase 2 if a foreign exception
958// is caught.
959_LIBUNWIND_EXPORT void
960_Unwind_DeleteException(_Unwind_Exception *exception_object) {
952 static_cast<void *>(context), (long long)result);
953 return result;
954}
955
956
957/// Called by personality handler during phase 2 if a foreign exception
958// is caught.
959_LIBUNWIND_EXPORT void
960_Unwind_DeleteException(_Unwind_Exception *exception_object) {
961 _LIBUNWIND_TRACE_API("_Unwind_DeleteException(ex_obj=%p)\n",
961 _LIBUNWIND_TRACE_API("_Unwind_DeleteException(ex_obj=%p)",
962 static_cast<void *>(exception_object));
963 if (exception_object->exception_cleanup != NULL)
964 (*exception_object->exception_cleanup)(_URC_FOREIGN_EXCEPTION_CAUGHT,
965 exception_object);
966}
967
968extern "C" _LIBUNWIND_EXPORT _Unwind_Reason_Code
969__gnu_unwind_frame(_Unwind_Exception *exception_object,
970 struct _Unwind_Context *context) {
971 unw_cursor_t *cursor = (unw_cursor_t *)context;
972 if (unw_step(cursor) != UNW_STEP_SUCCESS)
973 return _URC_FAILURE;
974 return _URC_OK;
975}
976
977#endif // _LIBUNWIND_ARM_EHABI
962 static_cast<void *>(exception_object));
963 if (exception_object->exception_cleanup != NULL)
964 (*exception_object->exception_cleanup)(_URC_FOREIGN_EXCEPTION_CAUGHT,
965 exception_object);
966}
967
968extern "C" _LIBUNWIND_EXPORT _Unwind_Reason_Code
969__gnu_unwind_frame(_Unwind_Exception *exception_object,
970 struct _Unwind_Context *context) {
971 unw_cursor_t *cursor = (unw_cursor_t *)context;
972 if (unw_step(cursor) != UNW_STEP_SUCCESS)
973 return _URC_FAILURE;
974 return _URC_OK;
975}
976
977#endif // _LIBUNWIND_ARM_EHABI