|
-
November 3rd, 2005, 03:59 PM
#1
debugger demands more???
Hey,
How do I set a breakpoint to occur when a byte in a buffer changes from 0x04h to any other value? I am using MSVC 6.0 and Windows XP.
The debugger complains hartily when I try to do this.
Code:
unsigned char* pbuf = new unsigned char[256];
for (int i = 0; i < 256; i++)
{//INITIALIZE ALL DATA
*(pbuf+i) = 0x04;
}
for (i = 0; i < 256; i++)
{//CHANGE DATA TO SIMULATE RE-INITIALIZE SHARED MEM
*(pbuf+i) = i;
}
delete[] pbuf;
Here is my example breakpoint:
*(pbuf+100) != 0x04
What is the best way to do this?
TIA,
ahoodin
-
November 3rd, 2005, 04:20 PM
#2
Re: debugger demands more???
Do you try the menu Edit > Breakpoints and data tab?
Good Answers, Good Points.
-
November 3rd, 2005, 04:24 PM
#3
Re: debugger demands more???
Yep, that is how I am setting the breakpoints.
In response when I start the debug session it also says that the breakpoints have been disabled.
Any ideas?
-
November 3rd, 2005, 04:34 PM
#4
Re: debugger demands more???
Hi ahoodin,
Setting Breakpoints When Values Change may be useful for you.
Jeff
-
November 3rd, 2005, 04:45 PM
#5
Re: debugger demands more???
Well, can't test right now with VC++ 6.0, but it works ok with VC++ 7.1.
-
November 3rd, 2005, 04:45 PM
#6
Re: debugger demands more???
I have the MSDN. I knew that stuff 5 years ago.
Thanks. I still have the problem. Anybody?
ahoodin
-
November 3rd, 2005, 04:46 PM
#7
Re: debugger demands more???
 Originally Posted by cilu
Well, can't test right now with VC++ 6.0, but it works ok with VC++ 7.1.
Thanks Cilu,
Will report back!
ahoodin
-
November 3rd, 2005, 05:17 PM
#8
Re: debugger demands more???
ye there is some catch associated with it, I can not seem to remember what was it.
Good Answers, Good Points.
-
November 3rd, 2005, 06:15 PM
#9
Re: debugger demands more???
Hmm, I can't seem to bring up the web page linked above, but you should be able to set the breakpoint. Then hit CTRL-B, to bring up the "Breakpoints" dialog. Now, highlight your breakpoint in the bottom list, and hit the "Condition" button. Enter the condition into the edit box, and hit OK.
Note that the variable in question must be in the scope of the breakpoint, otherwise you won't "break".
Viggy
-
November 4th, 2005, 09:01 AM
#10
Re: debugger demands more???
 Originally Posted by MrViggy
Hmm, I can't seem to bring up the web page linked above, but you should be able to set the breakpoint. Then hit CTRL-B, to bring up the "Breakpoints" dialog. Now, highlight your breakpoint in the bottom list, and hit the "Condition" button. Enter the condition into the edit box, and hit OK.
Note that the variable in question must be in the scope of the breakpoint, otherwise you won't "break".
Viggy
Good Job! This is great. Is it possible to configure the debugger to break when the value changes no matter what function call may be executing and bring up the call stack?
ahoodin
-
November 4th, 2005, 10:43 AM
#11
Re: debugger demands more???
Additionally when I try to break on data tab with an expression, the IDE says unable to break on pBuf[100]!=0x04.
WTH?
ahoodin
-
November 11th, 2005, 05:00 PM
#12
Re: debugger demands more???
Sorry, I was swamped this past week...
I've never played with this, but bring up the breakpoint properties dialog, and click on the "Data" tab. It looks like you can enter an "expression" (which I would guess, could also just be a variable) that will cause the debugger to break when the expression changes.
As for the message, is "pBuf" within the scope of the breakpoint? That should work, I've used similar expressions to break when a string is a specific value (by entering pStr[0] == 'a' && pStr[1] == 'b', etc. Annoying, but it worked).
Viggy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|