thomas (08/09/82)
My procedure is roughly the following: 0. Run ps on the core file to get process number, etc. for the process you are interested in. 1. Run /etc/analyze, note the page table entries for the process you are interested in. The last one covers the user structure. 2. adb vmunix vmcore The map should look something like ? map `vmunix.23' b1 = 80000000 e1 = 80019d84 f1 = 20 b2 = 8001a000 e2 = 8001fa78 f2 = 19da4 / map `vmcore.23' b1 = 80000000 e1 = -1 f1 = 0 b2 = 0 e2 = 0 f2 = 0 3. Multiply the page table entry you got in step one by 200, this is the address of the page table in vmcore. Look at the next 80 (hex) locations with a /X format (i.e. if the page table were at 0af800 you would say 800af800,80/X the 80000000 is added to put the address into kernel space). There will be a number of entries at the end of the list that look like fxxxxxxx. These are the user structure entries. The last two point to the stack (and will be consecutive numbers). Take the bottom 4 digits of the second to last entry, multiply by 200 to get the address of the first stack page. Set the second half of the / map to point to this page. If the last 2 lines of the page table were f40002a6 f40002a7 f40002c2 f80002c3 f00002e2 f00002e3 f400029c f400029d then you would multiply 29c by 200 getting 53800 and set the map /*m 7ffffc00 7fffffff 53800 to point to the stack at the proper address. 4. Look at first 14 words beginning of the user structure. Using the example above, multiply 2a6 by 200 giving 54c00, then say 80054c00,14/X 80054c00: 7ffffe3c -1 -1 7fffedbc 1d1000 8001fbe0 8003a904 3 0 0 12104 12150 80038db4 18 8002072c 8003a974 7ffffe5c 7ffffe3c 800060ab c00004 The first number is the stack pointer, so stick it into usp: 7ffffe3c>usp The first number in the 4th line is the ap, next is the fp and following that is the pc: 7ffffe5c>ap 7ffffe3c>fp 800060ab>pc 5. Finally you are ready to do the stack trace: $c $c _sleep(800348fc,14) from 800060ab _iowait(800348fc) from 8000f8b7 _bread(0,1b) from 8000f392 _iupdat(800363f0,8001fd0c,8001fd0c,0) from 80002b86 _iput(800363f0) from 80002a81 _closef(80038db4) from 800024b1 _exit(0) from 800074be _rexit() from 8000742b _syscall() from 800098be _Xsyscall() from 80000e70 data address not found With a little more cleverness, assuming the user process is swapped in, you could probably trace it back into the user program (using the user program as symbol table, of course). What really needs to be done is for somebody to encapsulate this into a program, since it is purely mechanical. =Spencer