Solaris crash and adb Command Examples !!! 2008-10 NOTE!!! I had planned to expand this note to mdb, but Solaris has advanced so fast I can't keep up. In addition, Solaris 10g DTrace has to some extent replaced traditional debugging with mdb (and of course adb and crash). With DTrace come many sources of example code, real life debugging cases, and detailed explanations, either online or in books (e.g., Richard McDougall et al's " Solaris Performance and Tools: DTrace and MDB Techniques for Solaris 10 and OpenSolaris"). My note here is only interesting in case you need to use adb or crash on older systems. Back then, there was such scarcity of example cases that collection of those cases helps study. I apologize for misnaming this file as if it was mainly for mdb. My intention was to collect more examples of mdb use cases, but ended up with more of crash and adb. And then I decide to drop my plan altogether. But the filename is stuck to avoid the error URL not found. Solaris mdb(1) utility replaces crash(1M) and adb(1). In fact, beginning with Solaris 9, crash and its man page are completely gone. This note lists some case usage examples of crash and adb that I collected over the years. The commands are all applicable in mdb but may change in syntax. Using mdb (or crash or adb) usually involves dealing with hexidecimal numbers, being able to pick the correct one out of many in output, and applying the cryptic adb macros on them (only a small number of macros, shown in Appendix, need no addresses or symbols). Without enough examples, you would never learn how to use these powerful tools. This note does not introduce you to these tools, which can be accomplished by reading man pages and references [Panic] (Chapters 12,13) and [Garden]. If you don't know or forget, at least remember commands $q (quit) and $c (stack trace) in adb. The way to read the notes is, you type the command, e.g. crash. At the prompt (no prompt in case of adb), type the command, e.g. proc | grep myprogram. Then type another command, e.g. user with an argument explained in square brackets... Examples in [Filesystems] [p.111] crash, proc | grep myprogram -> user [proc slot, 1st column of proc output] -> file [number following F under OPEN FILES...], which shows file ref cnt, fs type, proc offset in file, flags=read [p.138] crash, vnode -l [value under crash file cmd ADDR column] [p.139] crash, od -x [value under crash file cmd ADDR column]. Output is: hexnum1: hexnum2 hexnum3 hexnum4 hexnum5 hexnum6: hexnum7 hexnum8 hexnum9 hexnum10 vfsp stream pages type [p.139] adb -k [pages, hexnum9 above]$ [number under DATA column on a row of segvn_ops]$ [vp from above]$ [data from above]$ [as from above]$ [segs from above]$ [data from above]$ [vp from above]$ [data from above]$ rootdir/W 0 -> ls / Never do that unless you need a system panic! [p.55] adb, $ [time output]-([lbolt output]%0t100)=Y shows the boot time. Can also do: time/D, lbolt/D -> 0t[time output]-0t[lbolt output]=Y [p.84] adb, *panicstr/s [p.85] adb, $ [pidp (used to be a typo pipd) from above]$ [ofile from above] $ [vnode from above]$ [stram from above]$ [wrq from above]$ [next from above]$ [pc from above]?i (/i if not from core file) [p.346] adb, $ [uarea from above]$ [hexnum from above]$ [hexnum from above]$ cachefree/W 0t[2x dec value of lotsfree], dyncachefree/W 0t[2x dec value of lotsfree]. This can be used to enable priority_paging on a live 32-bit system. For 64-bit, replace /D with /E (for examine) or /Z (for writing). Don't do this on Solaris 7 and above. [p.604] adb -k, ncsize/D (for DNLC size). [p.622] adb -k, kas$ [segs from above]$ uinode [INO from above], (INUMB is inode of the remote file) Other Examples adb, $ [lwp from above]$ [ADDR from above]$ [tlist from above]$ [sp from above]$c, [WCHAN from ps output]$