Inserting breakpoints while debugger is running

cancel
Showing results for 
Search instead for 
Did you mean: 

Inserting breakpoints while debugger is running

180 Views
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?

Labels (2)
0 Kudos
2 Replies

23 Views
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 Kudos

23 Views
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 Kudos