Exetools

Exetools (https://forum.exetools.com/index.php)
-   General Discussion (https://forum.exetools.com/forumdisplay.php?f=2)
-   -   nice hexrays thing (https://forum.exetools.com/showthread.php?t=12598)

Shub-Nigurrath 12-27-2009 05:57

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.

ZeNiX 12-28-2009 12:07

I did not know that Hex-rays is so clever.
It can tell the arguements not used and variables lost.

redbull 01-06-2010 20:48

Yeah seems to have been optimized. Awesome


All times are GMT +8. The time now is 15:05.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX