Hi,
Testcase: baseservices/compilerservices/RuntimeHelpers/ExecuteCodeWithGuaranteedCleanup/ExecuteCodeWithGuaranteedCleanup.exe
MIPS64 thrown such error:
apply_reg_state: ip and cfa unchanged; stopping here (ip=0xfff6c20098)
Then PAL_VirtualUnwind will set PC to ZERO because curPc unchanged for native code (here is not Managed code, and the testcases for Manged code exception handling are PASSED) because PC = 0xfff6c20098:
(gdb) x/22i 0xfff6c20098-44
0xfff6c2006c <CallDescrWorkerInternal+108>: ld t0,16(s0)
0xfff6c20070 <CallDescrWorkerInternal+112>: ld t9,40(s0)
0xfff6c20074 <CallDescrWorkerInternal+116>: ld a0,0(t0)
0xfff6c20078 <CallDescrWorkerInternal+120>: ld a1,8(t0)
0xfff6c2007c <CallDescrWorkerInternal+124>: ld a2,16(t0)
0xfff6c20080 <CallDescrWorkerInternal+128>: ld a3,24(t0)
0xfff6c20084 <CallDescrWorkerInternal+132>: ld a4,32(t0)
0xfff6c20088 <CallDescrWorkerInternal+136>: ld a5,40(t0)
0xfff6c2008c <CallDescrWorkerInternal+140>: ld a6,48(t0)
0xfff6c20090 <CallDescrWorkerInternal+144>: jalr t9
0xfff6c20094 <CallDescrWorkerInternal+148>: ld a7,56(t0)
=> 0xfff6c20098 <CallDescrWorkerInternal+152>: lw t1,32(s0)
0xfff6c2009c <CallDescrWorkerInternal+156>: beqz t1,0xfff6c200e4 <CallDescrWorkerInternal+228>
0xfff6c200a0 <CallDescrWorkerInternal+160>: nop
0xfff6c200a4 <CallDescrWorkerInternal+164>: li at,0x4
0xfff6c200a8 <CallDescrWorkerInternal+168>: beq at,t1,0xfff6c200bc <CallDescrWorkerInternal+188>
0xfff6c200ac <CallDescrWorkerInternal+172>: nop
0xfff6c200b0 <CallDescrWorkerInternal+176>: li t0,0x8
0xfff6c200b4 <CallDescrWorkerInternal+180>: bne t0,t1,0xfff6c200c4 <CallDescrWorkerInternal+196>
0xfff6c200b8 <CallDescrWorkerInternal+184>: nop
0xfff6c200bc <CallDescrWorkerInternal+188>: b 0xfff6c200ec <CallDescrWorkerInternal+236>
0xfff6c200c0 <CallDescrWorkerInternal+192>: sdc1 $f0,56(s0)
As @janvorli suggested, MIPS64's log:
TID 0803: InitializeExceptionHandling(): ExceptionTracker size: 0x188 bytes
TID 0803: TrackerAllocator::Init() succeeded..
TID 0803: SetupThread managed Thread 000000012CE33B90 Thread Id = 1
TID 0803: Debugger Thread spinning up
TID 080b: SetupThread managed Thread 000000012CE4DBE0 Thread Id = 2
TID 0803: ******* MANAGED EXCEPTION THROWN: Object thrown: 000000FF4C011818 MT 000000FF71F14858T rethrow 0
TID 0803: Exception HRESULT = 0x80131500 Message String 0x000000FF4C011898 (db will display) InnerException 0000000000000000 MT 0000000000000000T
TID 0803: in Thread::SetLastThrownObject: obj = 000000FF4C011818
TID 0803: Processing exception at establisher=000000FFFF97FE90, ip=000000FF71EB69C4 disp->cxr: 000000FFFF97F8C0, sp: 000000FFFF97FE90, cxr @ exception: 000000012CF2FDA0
TID 0803: ..................................................................................
TID 0803: ProcessCLRException enter, sp = 0x000000FFFF97FE90, ControlPc = 0x000000FF71EB69C4
TID 0803: >>exr: 000000012CF2FFD0, code: e0434352, addr: 000000FF71EB69C4, flags: 0x00
TID 0803: >>NEW exception
TID 0803: TrackerAllocator: allocating tracker 0x000000012CE31A80, thread = 0x000000012CE33B90
TID 0803: ___________________________________________
TID 0803: creating new tracker object 0x000000012CE31A80, thread = 0x000000012CE33B90
TID 0803: StackTraceInfo::AllocateStackTrace (000000012CE31AC8)
TID 0803: CEHelper::SetupCorruptionSeverityForActiveException - Marked non-rethrow/non-nested exception as NotCorrupting.
TID 0803: CEHelper::SetupCorruptionSeverityForActiveException - Copied the corruption severity (2) to ThreadExceptionState.
TID 0803: ..ExceptionTracker::InitializeCurrentContextForCrawlFrame: DispatcherContext->ControlPC = 000000FF71EB69C4; IP in DispatcherContext->ContextRecord = 000000FF71EB6864.
TID 0803: ..ProcessCrawlFrame: PSP: 000000ff`ff97fe90 EstablisherFrame: 000000ff`ff97fe90
TID 0803: .. A:|00| 000000012CE31A80: (FFFFFFFFFFFFFFFF 0000000000000000) 1st pass
TID 0803: .. C:|00| 000000012CE31A80: (000000FFFF97FE90 000000FFFF97FE90) 1st pass
TID 0803: .. [ ProcessExplicitFrame: pFrame: 000000ff`ff97fd20 pMD: 00000000`00000000 FIRST PASS ]
TID 0803: ..ExceptionTracker::InitializeCurrentContextForCrawlFrame: DispatcherContext->ControlPC = 000000FF71EB69C4; IP in DispatcherContext->ContextRecord = 000000FF71EB6864.
TID 0803: .. [ ProcessManagedCallFrame this=000000012CE31A80, FIRST PASS ]
TID 0803: .. [ method: g, GCD.GCD ]
TID 0803: .. | uMethodStartPC: 000000FF71EB68A0, ControlPc at offset 120
TID 0803: CEHelper::CanMethodHandleException - Processing CorruptionSeverity: 2.
TID 0803: StackTraceInfo::SaveStackTrace (000000012CE31AC8), alloc = 1, replace = 1, skiplast = 0
TID 0803: StackTraceInfo::ClearStackTrace (000000012CE31AC8)
TID 0803: ..returning ExceptionContinueSearch
TID 0803: Processing exception at establisher=000000FFFF97FEB0, ip=000000FF71EB6864 disp->cxr: 000000FFFF97F8C0, sp: 000000FFFF97FEB0, cxr @ exception: 000000012CF2FDA0
TID 0803: ....................................................................................
TID 0803: ..ProcessCLRException enter, sp = 0x000000FFFF97FEB0, ControlPc = 0x000000FF71EB6864
TID 0803: ..>>exr: 000000012CF2FFD0, code: e0434352, addr: 000000FF71EB69C4, flags: 0x00
TID 0803: ..>>continued processing of PREVIOUS exception
TID 0803: CEHelper::SetupCorruptionSeverityForActiveException - Current tracker already has the corruption severity set.
TID 0803: ..ExceptionTracker::InitializeCurrentContextForCrawlFrame: DispatcherContext->ControlPC = 000000FF71EB6864; IP in DispatcherContext->ContextRecord = 000000FFEC1DCCC8.
TID 0803: ..ProcessCrawlFrame: PSP: 000000ff`ff97feb0 EstablisherFrame: 000000ff`ff97feb0
TID 0803: .. A:|00| 000000012CE31A80: (000000FFFF97FE90 000000FFFF97FE90) 1st pass
TID 0803: .. C:|00| 000000012CE31A80: (000000FFFF97FE90 000000FFFF97FEB0) 1st pass
TID 0803: .. [ ProcessManagedCallFrame this=000000012CE31A80, FIRST PASS ]
TID 0803: .. [ method: TryCode0, GCD.GCD ]
TID 0803: .. | uMethodStartPC: 000000FF71EB6790, ControlPc at offset d0
TID 0803: CEHelper::CanMethodHandleException - Processing CorruptionSeverity: 2.
TID 0803: StackTraceInfo::SaveStackTrace (000000012CE31AC8), alloc = 1, replace = 0, skiplast = 0
TID 0803: StackTraceInfo::ClearStackTrace (000000012CE31AC8)
TID 0803: ..returning ExceptionContinueSearch
I also followed @sdmaclea 's bulk of the work about ARM64/Unix patchset, but we are not sure, for example:
CFI directives for MIPS64 is not implement yet, so I just on purpose commented the .cfi_XXX for ARM64 to see whether or not ARM64 works, but clang failed to build for ARM64:
clang -cc1as: fatal error: error in backend: No open frame
UPDATEREG(Fp) failed to work for MIPS64, so we just commented it.
I argue that it is mismatch commit log message? And we are not sure about the .cfi_personality 0x1b, C_FUNC(\Handler) // 0x1b == DW_EH_PE_pcrel | DW_EH_PE_sdata4 for MIPS64.
And in the libunwind side, there is no cfa_reg_sp, cfa_reg_offset, fp_cfa_offset, ra_cfa_offset or sp_cfa_offset in MIPS's unw_tdep_frame_t.
Do we need to implement the CFI directives for CoreCLR and unw tdep frame for libunwind? Please give us some hint!
\cc @jashook @gkhanna79 @rahku @theaoqi @QiaoVanke
Thanks,
Leslie Zhai
Hi,
Testcase: baseservices/compilerservices/RuntimeHelpers/ExecuteCodeWithGuaranteedCleanup/ExecuteCodeWithGuaranteedCleanup.exe
MIPS64 thrown such error:
apply_reg_state: ip and cfa unchanged; stopping here (ip=0xfff6c20098)
Then PAL_VirtualUnwind will set PC to ZERO because curPc unchanged for native code (here is not Managed code, and the testcases for Manged code exception handling are PASSED) because PC = 0xfff6c20098:
As @janvorli suggested, MIPS64's log:
I also followed @sdmaclea 's bulk of the work about ARM64/Unix patchset, but we are not sure, for example:
CFI directives for MIPS64 is not implement yet, so I just on purpose commented the
.cfi_XXXfor ARM64 to see whether or not ARM64 works, but clang failed to build for ARM64:UPDATEREG(Fp)failed to work for MIPS64, so we just commented it.I argue that it is mismatch commit log message? And we are not sure about the .cfi_personality 0x1b, C_FUNC(\Handler) // 0x1b == DW_EH_PE_pcrel | DW_EH_PE_sdata4 for MIPS64.
And in the libunwind side, there is no cfa_reg_sp, cfa_reg_offset, fp_cfa_offset, ra_cfa_offset or sp_cfa_offset in MIPS's unw_tdep_frame_t.
Do we need to implement the CFI directives for CoreCLR and unw tdep frame for libunwind? Please give us some hint!
\cc @jashook @gkhanna79 @rahku @theaoqi @QiaoVanke
Thanks,
Leslie Zhai