Can I trust local variable value when analyzing a

2019-07-29 00:46发布

问题:

I see strange things like a pointer values changing the values (0 or something valid) between 2 calls with no change. Same with a enum values. The values are simply forwarded, no chances to be modified. The dump is minidunp.

回答1:

You can use dv /V to reveal if a local variable is living in a register. Like here:

0:000> dv /v @ecx this = 0x0018fe10

To get rid of this, you must remove optimization when compiling.



回答2:

Optimized build I assume? The problem is that the CPU doesn't deal in variables, but works with memory addresses and registers. As it happens, in release builds one register may be shared by many variables - not all at the same time, of course. But if the debugger can't work out what variable is now in the register, it may get quite confused.