View Single Post
Old 10 September 2021, 14:08   #15
Photon
Moderator
 
Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,647
To trace the stack, you must trace it because there's no telling how many movems (etc) are between SP and caller address when the crash occurs. Does Thrash'm One trace?

If not, you can trace yourself in a simple way, by logging the address you're calling just before the call. This could be in the form of a macro that replaces the call with code that logs it (PC address, call address) and then calls.

This list would grow very quickly. But you can have a circular buffer, and you can place it in a part of memory that you know the address to and which is not allocated, and then even a soft reset wouldn't prevent you from learning the last known address.

If you want subroutine names instead of addresses, it must survive back to the Assembler, though. ORGanizing the code temporarily while bug-hunting allows the logged addresses to mean something.

"Checkpoints" are a simpler similar alternative to tracing. You can write a single variable or address with the current PC address (or checkpoint name), and after a crash find the "last-survived-to" point in your code.
Photon is offline  
 
Page generated in 0.04590 seconds with 11 queries