STREAMS/UX for the HP 9000 Reference Manual
185
Debugging STREAMS/UX Modules and Drivers
Using adb
bl copen,rp [1]
[1] a procedure call to copen()
or:
bl creat+34,rp (save_pn_info) [1]
[1] a procedure call to save_pn_info()
By comparing the branches in the assembly code before and after the
instruction where the trap occurred with the procedure calls in the source
code, the corresponding source code line can often be determined. See the
examples at the end of this chapter for more details.
Other useful assembly code landmarks are the use of the extru, extrs, zdep,
and ldws instructions in checking and setting flag bits, and the use of the
compare and branch instructions, comb, combf, combt, comib, comibf, and
comibt, to implement if statements. For example, the ioctl() source code:
if ((fp->f_flag & (FREAD|FWRITE)) == 0)
is implemented by the assembly code:
ioctl+60: ldws 0(r8),r13 [1]
ioctl+64: extru r13,1F,2,r14 [2]
ioctl+68: comibf,=,n 0,r14,ioctl+80 [3]
[1] Load from memory address pointed to by r8, into r13.
[2] Extract 2 bits from r13, starting at bit 1F, place bits in r14.
[3] If r14 is not zero, branch to ioctl+0x80.
In the example above, fp is in r8. If fp were null, a trap type 15 would occur
at ioctl+60, when attempting to load off of a null pointer.
For more information about PA-RISC assembly language, see the Assembly
Language Reference Manual (part number 92432-90001), the PA-RISC 1.1
Architecture and Instruction Set Reference Manual (part number
09740-90039), or the PA-RISC Procedure Calling Conventions Reference
Manual (part number 09740-90015).