Issue with get_func_name

Hello everyone,

I’m trying to make a simple plugin that prints out all of the function names from the loaded binary using IDA’s C++ SDK. Get_func_qty returns the correct number of functions, but no matter what I try, get_func_name fails (returns -1), and the output parameter remains empty. Instead of getn_func, I’ve also tried get_screen_ea, inf_get_min_ea, etc., but I get the same result. Any recommendations would be highly appreciated.

IDA version: IDA Pro 9.1 & IDA SDK 9.1

Plugin code:

plugmod_t* idaapi init() {
    return PLUGIN_OK;
}

void idaapi term() {
}

bool idaapi run(size_t arg) {
    int FuncNum = get_func_qty();
    msg("FuncNum: (%d)\n", FuncNum);

    for (int i = 0; i < FuncNum; i++) {
        func_t* CurFunc = getn_func(i);
        if (CurFunc == nullptr) {
            msg("getn_func failed\n");
            return true;
        }

        qstring FuncName;
        if (get_func_name(&FuncName, CurFunc->start_ea) <= 0) {
            msg("Failed to get function name.\n");
            return true;
        }

        msg("FuncName: (%s) CurFunc: (%a)\n", FuncName.c_str(), CurFunc->start_ea);
    }

    return true;
}

__declspec(dllexport) plugin_t PLUGIN = {
    IDP_INTERFACE_VERSION,
    PLUGIN_PROC,   
    init,            
    term,       
    run,               
    "Description",
    "Help",
    "PluginTest",
    "Ctrl-Alt-S" 
};

I’ve also tried letting the code continue even after it fails, but the result is the same. Not only are the subs missing, but none of the other function names are printed either. Below is the output of the code without error checking in get_func_name(), which fails:

FuncNum: (54)
FuncName: () CurFunc: (80001000)
FuncName: () CurFunc: (80001040)
FuncName: () CurFunc: (80001060)
...

Hello @berk000,
At first glance, we didn’t notice anything peculiar that might explain such unexpected behavior.
Would you be able to share a sample IDB (you can do this via our support channel) so we can investigate this further?

Hello, thanks for the response. Sure, I’ll reach out through support soon and share the IDB

for the record, the issue was caused by the not defined __EA64__, which is required since IDA 9.0 dropped support for 32-bit databases.

1 Like