Skip to main content
edited tags
Link
Igor Skochinsky
  • 36.9k
  • 7
  • 65
  • 116
rephrasing question body to make commenter happy
Source Link

Let's say I have this program:

struct A {
    int x;
};

struct A func1(int z) {
    struct A result;
    result.x = z+1;
    return result;
}

int main() {
    return func1(1).x;
}

When compiling this on linux with gcc -m32 -fno-stack-protector the result of func1 will be returned as a stack pointer. How doCan I somehow set the type of func1 using __return_ptr so IDA understands this calling convention? I thought that would be the purpose of __return_ptr but, if not what does it doesn't seem to change anything in the decompilation.do?

Let's say I have this program:

struct A {
    int x;
};

struct A func1(int z) {
    struct A result;
    result.x = z+1;
    return result;
}

int main() {
    return func1(1).x;
}

When compiling this on linux with gcc -m32 -fno-stack-protector the result of func1 will be returned as a stack pointer. How do I set the type of func1 so IDA understands this calling convention? I thought that would be the purpose of __return_ptr but it doesn't seem to change anything in the decompilation.

Let's say I have this program:

struct A {
    int x;
};

struct A func1(int z) {
    struct A result;
    result.x = z+1;
    return result;
}

int main() {
    return func1(1).x;
}

When compiling this on linux with gcc -m32 -fno-stack-protector the result of func1 will be returned as a stack pointer. Can I somehow set the type of func1 using __return_ptr so IDA understands this calling convention? I thought that would be the purpose of __return_ptr, if not what does it do?

Source Link

What does __return_ptr do in IDA?

Let's say I have this program:

struct A {
    int x;
};

struct A func1(int z) {
    struct A result;
    result.x = z+1;
    return result;
}

int main() {
    return func1(1).x;
}

When compiling this on linux with gcc -m32 -fno-stack-protector the result of func1 will be returned as a stack pointer. How do I set the type of func1 so IDA understands this calling convention? I thought that would be the purpose of __return_ptr but it doesn't seem to change anything in the decompilation.