Skip to content

Instantly share code, notes, and snippets.

@infernalheaven
Forked from ChrisDietrich/export_symbols.idc
Created September 5, 2024 15:23
Show Gist options
  • Select an option

  • Save infernalheaven/1aa6d20bfca5c64fdb0713fe3b6e8c48 to your computer and use it in GitHub Desktop.

Select an option

Save infernalheaven/1aa6d20bfca5c64fdb0713fe3b6e8c48 to your computer and use it in GitHub Desktop.

Revisions

  1. @ChrisDietrich ChrisDietrich revised this gist Dec 29, 2019. No changes.
  2. @ChrisDietrich ChrisDietrich created this gist Dec 29, 2019.
    41 changes: 41 additions & 0 deletions export_symbols.idc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    // based on https://gist.github.com/hax0kartik/e358ce447a4537bcef534aa8de84817c
    #include <idc.idc>

    static FuncDump(f, start)
    {
    auto ea, str, teststr;

    ea = start;

    while( ea != BADADDR )
    {
    str = GetFunctionName(ea);
    if( str != 0 )
    {
    // Skip functions whose name is the generic sub_XXX()
    teststr = sprintf("sub_%X", ea);
    if( teststr != str )
    {
    fprintf(f, "%s 0x%X\n", str, ea);
    }
    }

    ea = NextFunction(ea);
    }
    }

    static main()
    {
    auto current = GetInputFile();
    current = AskFile(-1, current, "Where should I write the symbols to?");
    if(current == 0)
    {
    return -1;
    }
    auto f = fopen(current, "wb");
    Message("FuncDump: Start\n");

    FuncDump(f, 0x400000);
    fclose(f);
    Message("FuncDump: Done\n");
    }