ghidra icon indicating copy to clipboard operation
ghidra copied to clipboard

Decompiler: Restarted to delay deadcode elimination for space: register

Open lab313ru opened this issue 1 year ago • 3 comments

image

Subj. I don't know what exactly it means, but it breaks some code decompilation. For example, I have my custom Sleigh language, and this is how it gets decompiled: image

This code contains a lot of similar instructions with only some differences in indices and strings (I double checked it in the disasm). But, starting from the line 475 the decompiler decides to use another variable, which is incorrect, because at the line 478 it uses the same variable for different array_item_set arguments.

lab313ru avatar Jun 01 '23 18:06 lab313ru

Good: image

Wrong: image

lab313ru avatar Jun 01 '23 18:06 lab313ru

I believe it's not enough space to store some state for registers, that's why it resets.

lab313ru avatar Jun 01 '23 18:06 lab313ru

Solved by specifying in my cspec:

<deadcodedelay space="register" delay="10"/>

I don't know an exact value to use.

lab313ru avatar Jun 02 '23 09:06 lab313ru