Compilation strategy

Walter Bright newshound2 at digitalmars.com
Mon Dec 17 06:59:09 PST 2012


On 12/17/2012 4:38 AM, Jacob Carlborg wrote:> On 2012-12-17 10:58, Walter Bright 
wrote:
 >
 >> Google "convert object file to C"
 >
 > A few seconds on Google resulted in this:
 >
 > http://www.hex-rays.com/products/decompiler/index.shtml
 >

hex-rays is an interactive tool. It's "decompile" to things like this:

v81 = 9;
v63 = *(_DWORD *)(v62 + 88);
if ( v63 )
{
    v64 = *(int (__cdecl **)(_DWORD, _DWORD, _DWORD,
    _DWORD, _DWORD))(v63 + 24);
    if ( v64 )
      v62 = v64(v62, v1, *(_DWORD *)(v3 + 16), *(_DWORD
      *)(v3 + 40), bstrString);
}

It has wired in some recognition of patterns that call standard functions like 
strcpy and strlen, but as far as I can see not much else. It's interactive in 
that you have to supply the interpretation.

It's pretty simple to decompile asm by hand into the above, but the work is only 
just beginning. For example, what is v3+16? Some struct member?

Note that there is no type information in the hex-ray output.


More information about the Digitalmars-d mailing list