Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!im4u!ut-sally!ut-ngp!infotel!pollux!ti-csl!peters From: peters@ti-csl.UUCP Newsgroups: comp.sys.m68k Subject: stack backtrace on a 68010 Message-ID: <18534@ti-csl.CSNET> Date: Mon, 6-Apr-87 20:42:36 EST Article-I.D.: ti-csl.18534 Posted: Mon Apr 6 20:42:36 1987 Date-Received: Thu, 9-Apr-87 03:48:15 EST Organization: TI Computer Science Center, Dallas Lines: 23 Keywords: 68k stack I am trying to construct a stack backtrace routine to run on a 68010 system we are building (Internal use only. This is not a product announcement.). I'm after the sort of thing that adb will give you when you use the $c command. Unfortunately, all of our Unix source is for the Vax, so I can't just lift the algorithm from adb. At any given point in time, the frame pointer (in our case, A6) is pointing at the previous value of A6, conveniently stored on the stack. Continuing to unwind the stack, you find the return address of the jsr, right next to where A6 is pointing now . Then the fun begins. Next in line is the top of the previous routine's stack. The bottom of the frame can be determined from the place A6 is pointing right now. Great, we've got the top of the stack and the bottom of the frame for the previous routine. Next you need to find the bottom of the stack (or the top of the frame) so you can distinguish the stack (parameters to the next routine) from the local variables (the frame of this routine). Easier said than done--at least I haven't figured out how to do it yet. I just keep bumping into this glob that's part frame and part stack (and I don't know how much of each). If anyone out there would care to enlighten me on this subject, I would be in your debt (figuratively speaking, of course).