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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
2,755 次查看
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.
标签 (1)
标记 (1)
1 解答
991 次查看
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

在原帖中查看解决方案

2 回复数
992 次查看
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
991 次查看
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 项奖励
回复