yegord / snowman

Snowman decompiler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[IDA Plugin]Represent Decimal offsets to Hex ?

Tetragromaton opened this issue · comments

So as you know after decompilation of some code you have offsets in decimal value, so how to make decompiler convert all the decimal offsets to hex ?

Like:

ECX->f500 | In decimal
should
ECX->0x1F4

Hi, if you are willing to patch Snowman, here is the diff that will do it:

diff --git a/src/nc/core/ir/cgen/CodeGenerator.cpp b/src/nc/core/ir/cgen/CodeGenerator.cpp
index 041dc8b7..cae523dd 100644
--- a/src/nc/core/ir/cgen/CodeGenerator.cpp
+++ b/src/nc/core/ir/cgen/CodeGenerator.cpp
@@ -150,7 +150,7 @@ const likec::StructType *CodeGenerator::makeStructuralType(const types::Type *ty
                     tree_.makeArrayType(tree_.makeIntegerType(CHAR_BIT, false), offsetValue - type->size() / CHAR_BIT)));
             }
             typeDeclaration->type()->addMember(std::make_unique<likec::MemberDeclaration>(
-                QString("f%1").arg(offsetValue), makeType(offsetType->pointee())));
+                QString("0x%1").arg(offsetValue, 0, 16), makeType(offsetType->pointee())));
         }
     }