Inserting breakpoints while debugger is running

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

Inserting breakpoints while debugger is running

758 次查看
jdupre
Contributor II

Re: LPCXpresso 8.1.4_606

 

I am having trouble debugging when inserting or activating breakpoints "live" (while the code is running).

 

I am reading data from a UART and putting it in an array. In normal operation, the values put in the array should never be 0.  I have the following debug trap in my code:

 

if (data[0] == 0) {

    NOP;  //#define NOP __asm volatile("nop")

}

 

When I put a breakpoint at the NOP before starting the code, the breakpoint is never reached, indicating that the data extracted from the uart is correct.  However, if I insert the breakpoint (or activate it by ticking a pre-inserted breakpoint's checkbox) while the code is running, the break is called immediately.  When I look at the values in my array, they are all zeros!

 

When I use the suspend button to stop the code in an arbitrary place, my array is never filled with zeros.  The zeros in the array appear to be unique to placing or activating a breakpoint while the code is running. 

 

Can someone please explain this behavior?

标签 (2)
标记 (2)
0 项奖励
回复
2 回复数

601 次查看
avt
Contributor III

afaik, when inserting a breakpoint 'live' the debugger does this by stopping the cpu, inserting the breakpoint and then restarting (without you seeing it do it!). Would this explain what you are seeing?

0 项奖励
回复

601 次查看
jdupre
Contributor II

It must take quite a bit of time to do that, because I have just discovered that toggling a breakpoint on and off does corrupt my serial IO.  Every time.  I'll have to rethink my debug methods...

0 项奖励
回复