Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Types] Create function pointer type #45

Open
mari-mari opened this issue Jan 25, 2022 · 2 comments · May be fixed by #387
Open

[Types] Create function pointer type #45

mari-mari opened this issue Jan 25, 2022 · 2 comments · May be fixed by #387
Assignees
Labels
feature-request New feature or request priority-low Low priority issue

Comments

@mari-mari
Copy link
Collaborator

mari-mari commented Jan 25, 2022

Proposal

Add support to function pointers.

If a variable is called at some point, the type of it could be set to a function pointer.

Consider the following example:

$ python decompile.py extractme main
...
      int var_0;
...
      memcpy(var_0, 0x804c020, 71);
      var_0();
      var_0 = 0;
...

here, since the var_0 is being called after initialization, we can set its type to function pointer instead of integer.
extractme.zip

Approach

  • add new type FunctionPointer with the following fields
    • name
    • return type
    • parameter / argument types
  • update TypePropagation to consider variables that are being called.
  • update CodeGenerator to generate declarations for the corresponding function pointers if needed.
@mari-mari mari-mari added feature-request New feature or request priority-low Low priority issue labels Jan 25, 2022
@fnhartmann
Copy link
Collaborator

/cib

@fnhartmann fnhartmann self-assigned this Feb 22, 2024
Copy link
Contributor

Branch issue-45-_Types_Create_function_pointer_type created!

github-actions bot added a commit that referenced this issue Feb 22, 2024
@github-actions github-actions bot linked a pull request Feb 22, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request priority-low Low priority issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants