1

Given the sample code below:

#include <iostream> 

struct Data {
    int a;
    int b;
    int c;
};

int main() {
    Data *d = new Data;
    d->a = 1337;
    d->b = 1338;
    d->c = 1339;

    std::cout << d << std::endl;

    return 0;
}

Printing out the address of the pointer d is never the same (which seems logical). But the pointer that points to the base of d is also never the same.

Is there a way to find a static address that is always the same and points to the base of d? Or do I need to do this with a signature scan?

The main purpose is to always have a pointer to the base of d, without disassembling it when I restarting the program.

  • Is the addition "on Mac OS" in your title and tags relevant? The observed behavior is common for almost all operating systems. – usr2564301 Dec 28 '17 at 14:05
  • "Is there a way to find a static address ..." when live debugging? (I guess so; but maybe you might want to add the procedure you are using.) – usr2564301 Dec 28 '17 at 14:07
  • 1
    why is the first observation "logical" but the other isn't? – Igor Skochinsky Dec 28 '17 at 23:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.