Description
Version and Platform (required):
- Binary Ninja Version: 5.1.7363-dev Personal (acd6c39c)
- OS: Mac
- OS Version: 14.6.1
- CPU Architecture: M1
Bug Description:
When analyzing any C++ binary that has symbols, it seems that binja tries to automatically set the function arguments based on this symbol information. However, it misses any hidden parameters, e.g. this
or the return value pointer for functions that return an object.
Steps To Reproduce:
I made this small test program to demonstrate the issue:
#include <stdio.h>
#include <string.h>
class MyClass
{
public:
void Init()
{
x = 1.0f;
y = true;
strcpy(z, "Hello");
}
void Print(const char* prefix)
{
printf("%s: x=%g y=%i z=%s\n", prefix, x, y, z);
}
MyClass Copy()
{
return *this;
}
private:
float x;
bool y;
char z[0x10];
};
int main(int argc, const char* argv[])
{
MyClass a;
a.Init();
a.Print("a");
MyClass b;
b = a.Copy();
b.Print("b");
return 0;
}
Please provide all steps required to reproduce the behavior:
- Compile the binary with symbols
g++ test.cpp -o symbols_test
and open in binja - Look at
MyClass::Init
andMyClass::Print
methods and observe that they're missing thethis
argument - Look at
MyClass::Copy
method and observe that it is missing return value argument andthis
argument - Strip the binary
strip symbols_test -o nosymbols_test
and open in binja - Look at the same methods and see that they now have the correct number of arguments (1 for Init/Print, 2 for Copy)
Incorrect output screenshot:
Expected Behavior:
For thiscall methods, the implicit this
parameter should be accounted for. For methods that return an object, a return value argument should also be accounted for.
For the example case above, this is what the manually fixed up output looks like:
Screenshots/Video Recording:
If applicable, please add screenshots/video recording here to help explain your problem.
Binary:
Additional Information:
Please add any other context about the problem here.