use*_*923 5 .net clr assembly il exception-handling
考虑以下IL代码:
.method public static void Main()
{
ldstr "Starts Here"
call void [mscorlib] System.Console::WriteLine(string)
.try {
ldstr "Try Me!"
call void [mscorlib] System.Console::WriteLine(string)
leave.s Done
}
catch [mscorlib] System.Exception {
ldstr "Catch Me!"
call void [mscorlib] System.Console::WriteLine(string)
leave.s Done
}
Done:
ldstr "Ends Here"
call void [mscorlib] System.Console::WriteLine(string)
ret
}
Run Code Online (Sandbox Code Playgroud)
CLR如何try在JIT编码中定义块?本机代码看起来如下:
...
00900076 8b0538214703 mov eax,dword ptr ds:[3472138h] ("Starts Here")
...
00900090 8b053c214703 mov eax,dword ptr ds:[347213Ch] ("Try Me!")
...
009000a2 eb1b jmp 009000bf ;// Done
009000a4 8945d4 mov dword ptr [ebp-2Ch],eax
009000a7 8b0540214703 mov eax,dword ptr ds:[3472140h] ("Catch Me!")
...
009000b8 e888293b73 call clr!JIT_EndCatch (73cb2a45)
009000bd eb00 jmp 009000bf ;// Done
;// Done:
009000bf 8b0544214703 mov eax,dword ptr ds:[3472144h] ("Ends Here")
...
009000d6 c3 ret
Run Code Online (Sandbox Code Playgroud)
我们可以看到块clr!JIT_EndCatch的开始和结束在try哪里?
| 归档时间: |
|
| 查看次数: |
185 次 |
| 最近记录: |