STREAMS/UX for the HP 9000 Reference Manual
206
Debugging STREAMS/UX Modules and Drivers
Debugging Examples
However, there is an alternative way to find out the value of lp. If we can
determine what the procedure that called spput() set arg0 to before the call,
we will know the value of q, and lp is q->q_ptr.
The procedure which called spput() is csq_lateral(). The point where the
call was made is marked with an asterisk. Note that the procedure call here
is made using the instruction ble instead of the usual instruction bl. This is
because csq_lateral does not know the name of the procedure it is going to
call. csq_lateral() is passed a structure which contains the address of a
procedure to call and the arguments with which to call it. Because the
compiler cannot tell at compile time how far away in the executable image
the procedure address is, it must use a branch and link external, ble,
instruction in order to be sure it will be able to reach the procedure address
being branched to.
csq_lateral+40,15?ia
csq_lateral+40: ldws 8(r3),arg2
csq_lateral+44: depi -1,1E,1,arg2
csq_lateral+48: stws arg2,8(r3)
csq_lateral+4C: bl csq_turnover+108,rp (UNCRIT)
csq_lateral+50: or r6,r0,arg0
csq_lateral+54: ldw 10(r5),ret1
csq_lateral+58: comibt,=,n 0,ret1,csq_lateral+68
csq_lateral+5C: ldw 10(r5),arg0
csq_lateral+60: ldw 1C(arg0),r19
csq_lateral+64: bb,<,n r19,18,csq_lateral+84
csq_lateral+68: ldw 1C(r5),arg1
csq_lateral+6C: stw r0,1C(r5)
csq_lateral+70: ldw 14(r5),r6
csq_lateral+74: ldw 18(r5),arg0
* csq_lateral+78: ble 0(sr4,r6)
csq_lateral+7C: or r31,r0,rp
csq_lateral+80: b,n csq_lateral+8C
At csq_lateral+0x74, arg0 is loaded from r5 + 0x18. So if we can find out
what value r5 had at that point, we can determine the value of q. r5 is a
callee save register, so there is a chance that spput saved r5 in its stack
frame. We look at the first few instructions of spput:
spput/6i
spput:
spput: stw rp,-14(sp)
ldo 40(sp),sp
or arg1,r0,r31
ldw 14(r31),r22
ldbs 0xD(r22),arg1
ldo -41(r0),arg2