Board index » cppbuilder » conditional breakpoints and 'this'

conditional breakpoints and 'this'


2008-07-18 03:11:45 PM
cppbuilder3
Hi all,
Using BCB 6 - how do I set a conditional breakpoint and check if the 'this'
pointer is equal to a certain value? No matter what I try, I can't get the
syntax right. Any suggestions?
Cheers,
Andrew
 
 

Re:conditional breakpoints and 'this'

how about something like this:
condition: (unsigned) this == <whateveryourvalueis>
bds2006 seems to accept that, don't know about bcb6...
"Andrew Smith" < XXXX@XXXXX.COM >wrote in message
Quote
Hi all,

Using BCB 6 - how do I set a conditional breakpoint and check if the
'this' pointer is equal to a certain value? No matter what I try, I can't
get the syntax right. Any suggestions?

Cheers,

Andrew

 

Re:conditional breakpoints and 'this'

"Andrew Smith" < XXXX@XXXXX.COM >wrote in message
Quote
Using BCB 6 - how do I set a conditional breakpoint and check if the
'this' pointer is equal to a certain value?
Add a breakpoint, in the Breakpoint List window right-click your breakpoint
and choose "Properties". In the "Condition" edit box put something like:
this == some_variable
this == (variable_type*) 0x1234567
Where 0x1234567 is a specific value you are waiting for.
Quote
No matter what I try, I can't get the syntax right.
Can you show what you've tried? What error messages are you getting?
Clayton
 

{smallsort}

Re:conditional breakpoints and 'this'

On or about Fri, 18 Jul 2008 17:11:45 +1000 did "Andrew Smith"
< XXXX@XXXXX.COM >dribble thusly:
Quote
Hi all,

Using BCB 6 - how do I set a conditional breakpoint and check if the 'this'
pointer is equal to a certain value? No matter what I try, I can't get the
syntax right. Any suggestions?
I suggest you add code to check the value, with a dummy line inside a block
which has the breakpoint. Seomthing like this:
if (this==[expected value])
{
int foo=1; // set breakpoint here
}
Conditional breakpoints are *S-L-O-W*, while using the approach above is fast.
 

Re:conditional breakpoints and 'this'

Il Fri, 18 Jul 2008 22:06:01 -0400, Mike Ruskai < XXXX@XXXXX.COM >ha
scritto:
[snip]
Quote
if (this==[expected value])
{
int foo=1; // set breakpoint here
}

You can also use the 0xCC opcode to trigger a BKP:
#if defined( _DEBUG )
if (this==[expected value])
{
//int foo=1; // set breakpoint here
__emit__( 0xCC ); // Force a breakpoint here
}
#endif
HTH
Giuliano