-
watch variable??
i have used VS2005 to do programing ,but i find a problem while i'was looking into a variable(named hr ) with debugging.
such as the codes:
Code:
HRESULT DXUTChangeDevice( DXUTDeviceSettings* pNewDeviceSettings, IDirect3DDevice9* pd3dDeviceFromApp, bool bForceRecreate )
{
HRESULT hr;//problem,can't watch variable
DXUTDeviceSettings* pOldDeviceSettings = GetDXUTStat().GetCurrentDeviceSettings();
.
.
.
.
.
.
.
.
.
.
my question is why can't vs 2005 debuger watch the variable "hr" ,seem to me that think any complile optimization
-
Are you debugging in release mode? If so, then it's a common problem and the only solution is to look at the asm and try to track the register the value is stored in (or just print some debug messages).
-
you mean i'm should be debug mode,watching variable in asm ,is not my purpose!
-
If you debug in debug mode, you'll be able to see the values of each and every variable. Optimization sometimes removes variables.
-
yes, thanks for your reply but can't solve this problem yet
-
Well, are you debugging in debug mode or not?
Where are you trying to watch the variable from? It's a variable local to that function, so I imagine that watching it might not work too well if that function hasn't been called yet, for example.
-
no,i'm watch variable inside that function, not out of scope.
-
Well then the variable is probably being optimised out of existence. Disable as many optimisations as you can and see what happens.
-
Third time's a charm:
Are you debugging in debug mode or release mode?