Next | Prev | Up | Top | Contents | Index

Loading and Invoking idbg

Superuser privilege is required to invoke idbg, because it maps kernel memory. The command is ineffective unless its support modules have been made part of the kernel. This can be done permanently by changing the irix.sm file (see "Including idbg in the Kernel Image"). Alternatively, you can load the needed modules dynamically using the ml command, as follows:

# ml ld -i /var/sysgen/boot/idbg.o

Dynamic loading is discussed at more length in the idbg(1M) and ml(1M) reference pages.

When the support modules are loaded, idbg can be invoked in three styles.


Invoking idbg for Interactive Use

Invoking the command with no arguments causes it to enter interactive mode, prompting for one command after another from standard input, as shown in Example 11-5.

Example 11-5 : Invoking idbg Interactively

# idbg
idbg> plist 187
pid 187 is in proc slot 31
idbg> quit
#
The command terminates when the command quit is entered, or when control-D (standard input end of file) is typed.


Invoking idbg with a Log File

Invoking the command with the -r option and a filename causes it to write all its output to the specified file, as shown in Example 11-6.

Example 11-6 : Invoking idbg with a Log File

# idbg -r /var/tmp/idbg.save
idbg> plist 187
pid 187 is in proc slot 31
idbg> proc 31
proc: slot 31 addr 0x8832db30 pid 187 ppid 1 uid 0 abi IRIX5 
 SLEEP flags: load uload siglck recalc sv 
...
idbg> ^D
# cat /var/tmp/idbg.save
pid 187 is in proc slot 31
proc: slot 31 addr 0x8832db30 pid 187 ppid 1 uid 0 abi IRIX5 
 SLEEP flags: load uload siglck recalc sv 
...
#
You can use this method to collect a series of displays in a single file as you test a driver.


Invoking idbg for a Single Command

You can invoke idbg with a command on the command line. The output of the single command is written to standard output, where it can be captured or piped to another program. Example 11-7 shows one simple use of this feature.

Example 11-7 : Invoking idbg for a Single Command

# idbg plist | fgrep -c tcsh
3
#
Since the displays of idbg are very rich, there are endless opportunities to use this mode to generate data within shell scripts, and to process it using tools such as awk and perl. Using perl you could write an intelligent display routine that showed the status of your driver's private data structures using your own terminology and display format.


Next | Prev | Up | Top | Contents | Index