The examples in this section show how some of the device-related macros can be used to debug a driver.
The following ls -l command shows how the /devices path fits into the devinfo structure:
# ls -l /dev/ttya lrwxrwxrwx 1 root root 6 Aug 17 17:50 /dev/ttya -> term/a # ls -l /dev/term/a lrwxrwxrwx 1 root root 32 Aug 17 17:42 /dev/term/a -> ../../devices/obio/zs@0,100000:a
Example 18–1 shows how to obtain information about the /dev/ttya device from the devinfo structure and other kernel structures, beginning with devinfo_major.
# ls -lL /dev/ttya crw-rw-rw- 1 root sys 29, 0 Aug 17 17:42 /dev/ttya # ~stopped at: edd000d8: ta %icc,%g0 + 125 kadb[0]: 0t29$<devinfo_major ============== devinfo f5f0dcd0 binding_name 0xf5bb38f8: zs node_name 0xf5bb38f8: zs addr 0xf5f8d6a0: 0,100000 node_state 6 DS_READY major (hex) 1d instance 0 0xf5f0dcd0: parent child sibling f5f0f380 0 f5f0dba8 ============== devinfo f5f0dba8 binding_name 0xf5bb3a18: zs node_name 0xf5bb3a18: zs addr 0xf5f90560: 0,0 node_state 6 DS_READY major (hex) 1d instance 1 0xf5f0dba8: parent child sibling f5f0f380 0 f5f0da80
Example 18–2 shows the use of the devinfo_brief macro. It also shows the use of top_devinfo. top_devinfo is a pointer to the root of the devinfo tree (rootnexus)—all other devinfo nodes are descendants of this node. If you want to look at the device tree top-down in the debugger, this is where you start.
kadb[0]: *top_devinfo$<devinfo_brief ============== devinfo f5f0fde8 binding_name 0xf5bc6a30: SUNW,SPARCstation-10 node_name 0xf5bc6af8: SUNW,SPARCstation-10 addr 0xf5f90950: node_state 6 DS_READY major (hex) 1 0xf5f0fde8: parent child sibling 0 f5f0fcc0 0