Just use a real time tracer to find out. They are not cheap though. So debugging hiearchy:
-ICP or in circuit programmer, lets you program the chip.
-JTAG lets you do jtaggy things, like stop the execution, and then read registers, memory, and io pins. It is intrusive.
-Trace will spit some information into your computer, so you will have real time information, what happens on the chip. it is not intrusive, unless AFAIK some commands will send information to the PC deliberately.
-In circuit emulator will run the entire code on your pc, real time and you have all the information.
A good compromise is the pin flipping and reading it with a scope or logic analiser. Although pin flipping can be much slower than the other parts of your microcontroller.