Exetools  

Go Back   Exetools > General > General Discussion

Notices

Reply
 
Thread Tools Display Modes
  #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
  #2  
Old 12-28-2009, 12:07
ZeNiX's Avatar
ZeNiX ZeNiX is offline
Administrator
 
Join Date: Feb 2009
Posts: 735
Rept. Given: 177
Rept. Rcvd 772 Times in 259 Posts
Thanks Given: 226
Thanks Rcvd at 910 Times in 247 Posts
ZeNiX Reputation: 700-899 ZeNiX Reputation: 700-899 ZeNiX Reputation: 700-899 ZeNiX Reputation: 700-899 ZeNiX Reputation: 700-899 ZeNiX Reputation: 700-899 ZeNiX Reputation: 700-899
I did not know that Hex-rays is so clever.
It can tell the arguements not used and variables lost.
Reply With Quote
  #3  
Old 01-06-2010, 20:48
redbull redbull is offline
Friend
 
Join Date: Mar 2004
Posts: 160
Rept. Given: 17
Rept. Rcvd 5 Times in 4 Posts
Thanks Given: 3
Thanks Rcvd at 6 Times in 6 Posts
redbull Reputation: 5
Yeah seems to have been optimized. Awesome
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A nice challenge.... hobgoblin General Discussion 1 01-28-2006 11:00
What's this thing on the FTP? theCaller General Discussion 5 10-27-2005 21:10
Patching a morphed thing... KaGra General Discussion 4 07-03-2005 00:38
Nice! ManSun General Discussion 2 04-22-2004 16:12


All times are GMT +8. The time now is 01:02.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( Since 1998 )