I wrote a c++ program, and when I’m using debug mode,
I put a pointer type variable (say m_pdummy) into the watch list, but it shows “bad ptr”;
If I expand this pointer(by clicking the “+” left to the name) and wants to see other variables under this pointer, all variables show “expression cannot be evaluated“;
However, in my code, I wrote some output stuff, like:
CString str;
DWORD d1;
d1 = m_pdummy->m_wgear;
str.Format("%d");
MessageBox(str);
and then message box shows correct value;
But if I drag m_pdummy, d1, str into watch list, all of them says either “expression cannot be evaluated” or “symbol not found“; But this is impossible because message box could show values;
So what’s the problem here?!
Best regards to whom read this,
Thanks!
Marson
Maybe the code you are debugging with is not exactly the one running, or the VS Compiler optimize your code so some of the code doesn’t exist anymore.
In the case of the former, the breakpoint and debug value cannot be watched, you should check out the code match the debugging one. I come up with this when I register COM server a ‘wrong’ dll.
In the case of the latter, you should close the optimization option. Hope this will help you.