Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Function pointer members

Programs often call a function through a pointer that a structure holds: a table of operations that a driver fills in, a dispatch table built by hand, or the virtual function table of a C++ class. The pseudocode shows such a call as a call through a structure member:

g_pro_ops.start(dev);
ops->start(dev);

Enter or a double click on the member of such a call (start above) goes to the function that the member points to.

When the pseudocode names the object

When the pseudocode shows which object holds the member, IDA reads the pointer out of that object and goes to the function at once. The object can be:

  • a global: g_pro_ops.start()

  • an element of an array with a constant index: g_tab[1].start()

  • a member of another structure or union: g_dev.ops.start()

  • a chain of these

When the object is not known

The pseudocode often does not name the object. The pointer can come from a function parameter (ops->start()), or the index can be a variable or an index on a pointer (g_tab[i].start(), p[1].start()).

IDA then looks at every data item in the database that has the structure type applied, and reads the member out of each one:

  • if all of them point to the same function, IDA goes to it

  • if they point to different functions, a chooser named Possible callees of Type::member lists them, and you pick one

When there are more than 1000 objects to look at, for example a large array with the structure type, a wait box appears and you can cancel it.

The candidates come only from data items that have the structure type applied. IDA does not guess callees from function names. If the tables in your database are not typed, apply the structure type to them first.

When IDA goes to the declaration

Enter and a double click go to the declaration of the member in Local Types when:

  • the member is not called: an assignment, a comparison, or the address of the member

  • the member is not a function pointer

  • no candidate is found: no data item has the structure type applied, or the member does not point to the start of a function in any of them (for example, it is null, or it points to an imported function)

  • you cancel the wait box

Jump to structure definition (Z) always goes to the declaration.

C++ virtual calls

A virtual call is a call through a member of the virtual function table, so it works the same way, but only when the virtual function table is described by a structure type, such as Shape_vtbl, and the vtable pointer of the class has that type. The decompiler then shows the call as a member access:

and the vtables that have the Shape_vtbl type are the candidates.

When IDA has no such structure, the decompiler shows the virtual call as arithmetic on the vtable pointer, and there is no member to click:

This is usual for binaries built by GCC or Clang, also with DWARF debug information. To use the navigation there, create the vtable structure, give the vtable pointer the type of a pointer to it, and apply the structure type to the vtables of the classes.

Where it works

  • the pseudocode view, also with Alt+Enter (Jump to pseudocode in a new view)

  • the Dalvik class view

Last updated

Was this helpful?