We haven't started talking about multiprocessor systems yet nor the analysis work involved with MP system postmortem files. However, if we were to give you the exact pointers, you already have the knowledge needed to write a set of macros that will print the names of the processes running on each CPU of an MP system. Since we are giving you exact pointers, this exercise is for Solaris 2.3 systems only. To do the same for other versions of Solaris 2, you'll first need to look at the header files to verify the offsets in the structures you'll be traversing. Task:Write a set of macros that print the names of the processes running on each CPU. For more of a challenge, try to have your macros state if the CPU was idle. Givens:
Hints:Use the cpu* macros as a guide. However, use the cpu_next value to change the current address instead of trying to calculate an offset into the next cpu structure. If you use the offset method, as done in the cpu macro, you risk driving yourself crazy, as the offset for your macro will be quite different from the one used at the bottom of the cpu macro. In /usr/include/sys , you'll find cpuvar.h , thread.h , and proc.h of interest should you wish to learn more about the structures your macro will be wandering through. An example of output to aim for:Hiya... adb -k unix.6 vmcore.6 physmem bd90 $<proconcpu ncpus: ncpus: Number of CPUS: 4 cpu0+8: e1313ec0 Thread address 0xe1313f60: e00ed880 Proc address p0+0x260: sched This CPU was idle Next CPU... 0xf5692408: e134dec0 Thread address 0xe134df60: e00ed880 Proc address p0+0x260: sched This CPU was idle Next CPU... 0xf5692008: f5a31600 Thread address 0xf5a316a0: f6be3800 Proc address 0xf6be3a60: find /export/local -name core -exec rm {} ; Next CPU... 0xf5682c08: f6a7fc00 Thread address 0xf6a7fca0: f6685000 Proc address 0xf6685260: /opt/SUNWpop2/sbin/popd $q Hiya... Note that in this example we did not specify a macro directory. Why not? Instead, we copied our macros to the savecore directory where the crashes are located. adb looks in the current directory for macros before going to the default adb macro directory. |