uxmal / reko

Reko is a binary decompiler.
https://uxmal.github.io/reko
GNU General Public License v2.0
2.16k stars 253 forks source link

Add option to exclude common helper functions #469

Open rfalke opened 7 years ago

rfalke commented 7 years ago

Reko outputs helper functions from the compiler, libc and others. These helper functions make it harder to understand the source code. A command line option should be added to exclude such helper functions at least for the output. Maybe also for the decompilation. The not complete list used by holdec is:

                "__do_global_ctors_aux",
                "__do_global_dtors_aux",
                "__libc_init",
                "__setfpucw",
                "__libc_csu_init",
                "__libc_csu_fini",
                "__libc_start_main",
                "__fpstart",
                "__register_frame_info",
                "__register_frame_info_table",
                "__deregister_frame_info",
                "__frame_state_for",

                "_fini",
                "_init",
                "_start",
                "_mcount",
                "_cleanup",

                "init_dummy",
                "fini_dummy",
                "call_gmon_start",
                "frame_init",
                "frame_dummy",
                "decode_uleb128",
                "decode_sleb128",
                "fde_insert",
                "count_fdes",
                "add_fdes",
                "find_fde",
                "extract_cie_info",
                "execute_cfa_insn"
uxmal commented 7 years ago

Seems like this is specific to ELF binaries? Perhaps the reko distribution should be augmented with a file containing names of symbols to be ignored in ELF files. You can today mark individual finctions as "no-decompile" in reko, but obviously there is value in not having to do this manually for procedures that occur frequently. How does holdec manage this list? Is it hard-coded or kept in a file?

rfalke commented 7 years ago

For holdec it is hardcoded for every format (ELF, PE, LE, ...) but only ELF defines a non-empty list. Mostly because I concentrated on ELF so far.

I think you could also see these helper functions if you compile with gcc on windows. It depends more on the compiler, libc and other frameworks used.

rfalke commented 6 years ago

What about adding a command line option so that the user can decide if you do not want to encode the function list in reko?!

rfalke commented 1 year ago

Is there any progress on this? Any way to exclude functions by name?