Detecting areas with dead code.
tomsons26 opened this issue · comments
Would it be possible to use this to ID where there's dead code?
Sometimes it's useful to know what the decompiler omits.
like for example i had
*pDstT = iDu;
v5 = pDstT + 1;
*v5 = iDv;
pDstT = v5 + 1;
which was actually
format = D3DFMT_V8U8;
switch ( format )
{
case D3DFMT_V8U8:
*pDstT = iDu;
v5 = pDstT + 1;
*v5 = iDv;
pDstT = v5 + 1;
break;
case D3DFMT_L6V5U5:
*(_WORD *)pDstT = (iDu >> 3) & 0x1F;
*(_WORD *)pDstT |= 0x20 * ((iDv >> 3) & 0x1F);
*(_WORD *)pDstT |= (((signed int)uL >> 2) & 0x3F) << 0xA;
pDstT += 2;
break;
case D3DFMT_X8L8V8U8:
*pDstT = iDu;
v6 = pDstT + 1;
*v6++ = iDv;
*v6++ = uL;
*v6 = 0;
pDstT = v6 + 1;
break;
}
being able to tell that there was something missing here vs the asm automatically would be extremely useful
Finding out it was a switch in this case lead me to finding the original source code which turned out to be from DirectX SDK.
Likewise a similar case would be a
var = 0;
if(var) {}
where the decompiler would omit code.
I don't think that's the primary use of this plugin. One can not detect what deleted from AST purely by AST alone... I would advise to add volatile to some variables or to remove const from them. The problem does not lie in hexrays domain...