how to infer data type in ghidra decompilation result for /usr/bin/ls ?

data type



As I answered on your last question:

open ghidra gui, analyse the binary, click on file -> export program -> and export as a C/C++ file.

In this file, ghidra constructs possible typedefs for you.

For e.g. typedef unsigned char undefined1;

So, you'll know the possible type of this object. In your particular case, it constructs (assuming a stripped binary):

typedef unsigned long undefined8;

But, note that these types are just estimates and could be different than the original source code (in case of user defined functions).

| improve this answer | |
  • Could you be more exact on data type ? – kevin May 18 at 15:18
  • no, you can't as data type inference is still an unsolved problem – R4444 May 18 at 16:08
  • What do you man by "unsolved" ? This decompilation result has so many undefined8 – kevin May 20 at 7:54
  • 1
    i.e. correct type recovery from stripped binaries is not fully possible yet. If you get undefineds then it is possible that the decompiler is not able to detect correct types and marked it as a custom type – R4444 May 20 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.