Skip to content

Instantly share code, notes, and snippets.

@redknightlois
Created July 12, 2016 16:32
Show Gist options
  • Save redknightlois/3a5e439f2c5e371ec086bf1bf3dd2cfb to your computer and use it in GitHub Desktop.
Save redknightlois/3a5e439f2c5e371ec086bf1bf3dd2cfb to your computer and use it in GitHub Desktop.
Try-Catch
public static void Main(string[] args)
{
int i = 0;
try
{
checked
{
i++;
};
}
catch (OverflowException)
{
}
Console.WriteLine(i);
}
int i = 0;
00007FFAEE230B22 sub esp,30h
00007FFAEE230B25 lea rbp,[rsp+30h]
00007FFAEE230B2A mov qword ptr [rbp-10h],rsp
00007FFAEE230B2E xor ecx,ecx
00007FFAEE230B30 mov dword ptr [rbp-4],ecx
try
{
checked
{
i++;
00007FFAEE230B33 mov dword ptr [rbp-4],1
00007FFAEE230B3A jmp 00007FFAEE230B42
00007FFAEE230B3C call 00007FFB4DD0E140
00007FFAEE230B41 int 3
Console.WriteLine(i);
00007FFAEE230B42 mov ecx,dword ptr [rbp-4]
00007FFAEE230B45 call 00007FFAEE2306E0
00007FFAEE230B4A nop
00007FFAEE230B4B lea rsp,[rbp]
00007FFAEE230B4F pop rbp
00007FFAEE230B50 ret
int i = 0;
00007FFAEE230B51 push rbp
00007FFAEE230B52 sub rsp,30h
00007FFAEE230B56 mov rbp,qword ptr [rcx+20h]
00007FFAEE230B5A mov qword ptr [rsp+20h],rbp
00007FFAEE230B5F lea rbp,[rbp+30h]
00007FFAEE230B63 lea rax,[7FFAEE230B42h]
Console.WriteLine(i);
00007FFAEE230B6A add rsp,30h
00007FFAEE230B6E pop rbp
00007FFAEE230B6F ret
int i = 0;
00007FFAEE220B20 sub rsp,28h
00007FFAEE220B24 mov ecx,1
00007FFAEE220B29 call 00007FFAEE2206E0
00007FFAEE220B2E nop
00007FFAEE220B2F add rsp,28h
00007FFAEE220B33 ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment