View Single Post
  #1  
Old 12-27-2009, 05:57
Shub-Nigurrath's Avatar
Shub-Nigurrath Shub-Nigurrath is offline
VIP
 
Join Date: Mar 2004
Location: Obscure Kadath
Posts: 971
Rept. Given: 70
Rept. Rcvd 431 Times in 101 Posts
Thanks Given: 83
Thanks Rcvd at 405 Times in 127 Posts
Shub-Nigurrath Reputation: 400-499 Shub-Nigurrath Reputation: 400-499 Shub-Nigurrath Reputation: 400-499 Shub-Nigurrath Reputation: 400-499 Shub-Nigurrath Reputation: 400-499
nice hexrays thing

Hi all,
I was testing the newest leaked hexrays with this example:

Code:
int main(int argc, char* argv[])
{
  int firstvalue = 5;
  int *p1;
  p1 = &firstvalue;
  *p1 = 10;
  return 0;
}
which produces this simple assembler:

Code:
push    ebp
mov     ebp, esp
sub     esp, 8
mov     [ebp+var_4], 5
lea     eax, [ebp+var_4]
mov     [ebp+var_8], eax
mov     ecx, [ebp+var_8]
mov     dword ptr [ecx], 0Ah
xor     eax, eax
mov     esp, ebp
pop     ebp
retn
the strange is that if you try to decompile it with hexrays you get only this:

Code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
  return 0;
}
Even if it doesn't seem at first sight, the code is, by the logical point of view, exactly the same because the variables are local therefore lost, the stack is restored. This is imho a nice view of how powerful is this plugin even for this simple case.
__________________
Ŝħůb-Ňìĝùŕřaŧħ ₪)
There are only 10 types of people in the world: Those who understand binary, and those who don't
http://www.accessroot.com
Reply With Quote