The Joys of Backtrace
Rick Murray (539) 13840 posts |
Just spent a good long while getting a fairly simple backtrace to work. Now there is something crying out for a HowTo. I have PC, function name (if available), and function address. I can’t figure out how to extract the saved registers, as it appears to just push what is necessary (so without finding the STMFD instruction and taking it apart, can you even tell which registers were saved…if any? Along the way I noticed some Korean outfit has grabbed a copy of my assembler tutorial (I guess they don’t understand what off-line means?). http://www.pldworld.com/altera/html/excalibur/asm-site/ I did notice that CC 5.70 can be easily trashed by referring to PC in an inline __asm block.
(because there appears to be no _kernel_meh function to determine this at runtime, unless you cheat and look to see if _kernel_processormode() is > 3)The result?
So, back to writing proper assembler. ;-) |
Steve Pampling (1551) 8170 posts |
They left in the copyright references. You could look on it as free hosting. |
Rick Murray (539) 13840 posts |
After looking at how CLib does it, yeah. You have the frame creation instruction loaded, so it is just a small matter of pulling it apart to work out which registers were actually saved, to then retrieve them. A bit of work with Theo’s docs, *Memory, and the ARM ARM and I got it sussed.
It would be nice to have some crash-site registers, but I’m not sure if these are recorded. Removing all my signal handling gave me an old style CLib backtrace which didn’t list at-crash registers, so I am guessing maybe CLib doesn’t do this? Oh my. It’s quarter past one (already?). Time to quit for tonight! |