Getting memory location of C++ static variable in Visual Studio Community Debugger

0

In this simple C++ program:

int main() {
    int n = 0xffffff12;
    static int q = 0x7fffffff;
    static int r = 0x10000000;
    static int R = 0x80000000;
    return 0;
}

I can retrieve the actual memory location of variable n in Visual Studio Community debugger by looking at the assembly instruction in disassembly, getting the offset from that instruction, and adding it to the base pointer (EBP).

But since static variables are allocated on program startup, how would I get their memory locations in the Visual Studio Debugger?

visual studio community debugger windows

c++
visual-studio
debugging
memory
static
asked on Stack Overflow Sep 29, 2019 by platizin

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0