STREAMS/UX for the HP 9000 Reference Manual

203
Debugging STREAMS/UX Modules and Drivers
Debugging Examples
printf(“Routine spput: Should not be here\n”);
break;
}
}
Here is the relevant portion of the assembly code. The instruction where the
panic occurred is marked with an “*”.
spput,40?ia
spput:
spput: stw rp,-14(sp)
spput+4: ldo 40(sp),sp
spput+8: or arg1,r0,r31
spput+0xC: ldw 14(r31),r22
spput+10: ldbs 0xD(r22),arg1
spput+14: ldo -41(r0),arg2
spput+18: ldo -41(arg1),arg3
spput+1C: combt,=,n arg2,arg3,spput+30
spput+20: ldo -40(r0),ret1
spput+24: combt,=,n ret1,arg3,spput+30
spput+28: ldo 42(r0),r19
spput+2C: combf,=,n r19,arg3,spput+78
spput+30: ldw 14(arg0),arg1
spput+34: ldws 8(arg1),ret0
spput+38: comibf,=,n 0,ret0,spput+48
spput+3C: stws r31,8(arg1)
spput+40: b spput+54
spput+44: stws r31,0xC(arg1)
spput+48: ldws 0xC(arg1),r1
* spput+4C: stws r31,0(r1)
spput+50: stws r31,0xC(arg1)
spput+54: ldil 3B000,rp
spput+58: ldo 298(rp),r20
spput+5C: extru,= r20,1F,1,r21
spput+60: ldw -4(dp),r21
spput+64: ldo 1(r0),arg2
spput+68: bl spclose+0xB4,rp (timeout)
First, we try to get a general idea where spput+0x4C falls in the source code.
It occurs before the call to timeout() at spput+0x68. The pattern of combt
and combf instructions from spput+0x1C to spput+0x2C correspond to the
switch statement in the source code. We guess this by noticing that we have
loaded a value into arg3 which we compare against three different values,
which resembles the first three case statements in the switch statement. It is
unlikely that the default case of the switch statement, which just does a
printf(), would cause the system to panic. spput+0x4C is probably in the
source code in the case statement for M_DATA, M_PROTO, and
M_PCPROTO. The comibf instruction at spput+0x38 must correspond to
the if (!lp->mp) source statement, because it is a conditional branch
statement, and it is comparing a register to 0 (zero).