Information needed about Watchpoint conditions - Metrowerks for HCS12 V3.1

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Information needed about Watchpoint conditions - Metrowerks for HCS12 V3.1

Jump to solution
2,461 Views
EmbeddedCoder
Contributor III
Hi All,
 
I want to be able to increase my use of Watchpoints in the Metrowerks IDE, I see this as a very powerful tool that at present eludes me!
 
I can create a watchpoint that allows execution to stop on read or write of a given byte, but I am finding it hard (impossible!) to find information in the help files, application note library, web, with regard to the use of Watchpoint conditions - is there a seperate document showing how to use this?
 
For instance, I want to be able to break on a write to a memory location that results in a single bit inside that byte being cleared to zero, with all other writes not causing a break, I may also want to allow the first such write to pass by without breaking.
 
Does anyone have any info on this (ideally the whole condition syntax would be nice!)?
 
Thanks in advance.
Mike.
Labels (1)
Tags (1)
1 Solution
697 Views
CrasyCat
Specialist III
Hello
 
Expressions in the Watchpoint condition are using same syntax as ANSI C expressions.
 
For instance "globVar ==10" will stop if changes arises and variable gobVar is equal to 10.
 
In order to test if bit 1 at address 0x600 is set, the expression can be encoded as follows:
(*(unsigned char*)0x600 & 0x1) == 1
 
And so on.
Some limitation apply here. The debugger should be able to evaluate the expression at run time (i.e no function call allowed here for instance).
 
No try to think how you would evaluate your condition in ANSI C and try to use it in the command edit box.
Keep in mind that the debugger might not be able to trigger all conditions. if it does not work, then it does not work.
 
And also keep in mind that using conditional watchpoint might change real time behavior of the system. The system will not execute in real time any more. There will be some interactions from the debugger to evaluate the condition each time the area where the watchpoint is defined is modified.
 
CrasyCat

View solution in original post

2 Replies
698 Views
CrasyCat
Specialist III
Hello
 
Expressions in the Watchpoint condition are using same syntax as ANSI C expressions.
 
For instance "globVar ==10" will stop if changes arises and variable gobVar is equal to 10.
 
In order to test if bit 1 at address 0x600 is set, the expression can be encoded as follows:
(*(unsigned char*)0x600 & 0x1) == 1
 
And so on.
Some limitation apply here. The debugger should be able to evaluate the expression at run time (i.e no function call allowed here for instance).
 
No try to think how you would evaluate your condition in ANSI C and try to use it in the command edit box.
Keep in mind that the debugger might not be able to trigger all conditions. if it does not work, then it does not work.
 
And also keep in mind that using conditional watchpoint might change real time behavior of the system. The system will not execute in real time any more. There will be some interactions from the debugger to evaluate the condition each time the area where the watchpoint is defined is modified.
 
CrasyCat
697 Views
EmbeddedCoder
Contributor III
Thanks for that!!
 
I never thought of trying C in the box, and was trying all manner of regular expressions with no joy!
 
Works a treat now.
Mike
0 Kudos