Debugging rot13.c before fix: ba14a828c95b

rot13.c source

tenshi% ./6.rot13
hi
ui
6.rot13 373897: suicide: sys: trap: fault read addr=0x0 pc=0x200125
tenshi% acid 373897
/proc/373897/text:amd64 plan 9 executable
/sys/lib/acid/port
/sys/lib/acid/amd64
acid: new()
373906: system call	_main	SUBQ	$0x90,SP
373906: breakpoint	main+0x7	LEAQ	in+0x20a0(SP),BP
acid: asm(*PC)
main+0x7 0x000000000020002f	LEAQ	in+0x20a0(SP),BP
main+0xf 0x0000000000200037	MOVL	$0x0,0x8(SP)
main+0x17 0x000000000020003f	MOVL	$0x0,0x10(SP)
main+0x1f 0x0000000000200047	CALL	Binit(SB)
main+0x24 0x000000000020004c	CMPL	AX,$0xffffffff
main+0x27 0x000000000020004f	JNE	main+0x33(SB)
main+0x29 0x0000000000200051	MOVL	$.string(SB),BP
main+0x2e 0x0000000000200056	CALL	exits(SB)
main+0x33 0x000000000020005b	LEAQ	out+0x40(SP),BP
main+0x38 0x0000000000200060	MOVL	$0x1,SI
main+0x3d 0x0000000000200065	MOVL	SI,0x8(SP)
main+0x41 0x0000000000200069	MOVL	$0x1,SI
main+0x46 0x000000000020006e	MOVL	SI,0x10(SP)
main+0x4a 0x0000000000200072	CALL	Binit(SB)
main+0x4f 0x0000000000200077	CMPL	AX,$0xffffffff
main+0x52 0x000000000020007a	JNE	main+0x5e(SB)
main+0x54 0x000000000020007c	MOVL	$.string+0x17(SB),BP
main+0x59 0x0000000000200081	CALL	exits(SB)
main+0x5e 0x0000000000200086	MOVL	$0xffffffff,CX
main+0x63 0x000000000020008b	CMPL	CX,$0x0
main+0x66 0x000000000020008e	JEQ	main+0xe0(SB)
main+0x68 0x0000000000200090	LEAQ	in+0x20a0(SP),BP
main+0x70 0x0000000000200098	MOVL	$0xa,DI
main+0x75 0x000000000020009d	MOVL	DI,0x8(SP)
main+0x79 0x00000000002000a1	MOVL	$0x1,DI
main+0x7e 0x00000000002000a6	MOVL	DI,0x10(SP)
main+0x82 0x00000000002000aa	CALL	Brdstr(SB)
main+0x87 0x00000000002000af	MOVQ	AX,BP
main+0x8a 0x00000000002000b2	MOVQ	AX,str+0x30(SP)
main+0x8f 0x00000000002000b7	CALL	strlen(SB)
acid: lstk()
main()+0x7 /usr/seh/repos/plan9/C/rot13.c:13
	in=0x0
	out=0x0
	str=0x0
	len=0x0
_main+0x40 /sys/src/libc/amd64/main9.s:15
acid: regs()
AX    0x00007ffffeffef90
BX    0x00007ffffeffac68
CX    0x0000000000052206
DX    0x000000000005b492
DI    0x0000000000094416
SI    0xffffffff801102b4
BP    0x0000000000000001
R8    0xffffffff80247730
R9    0xffffffff8064a587
R10   0x0000000000000246
R11   0x000000000000000a
R12   0x00007ffffeffedb8
R13   0x0000000000000000
R14   0x0000000000000000
R15   0x0000000000000000
DS  0x0000  ES  0x0000  FS  0x0000  GS  0x0000
TYPE  0x0000000000000003
ERROR 0xffffffff80110707
PC    0x000000000020002f
CS    0x000000000000002b
FLAGS 0x0000000000000206
SP    0x00007ffffeffadf0
SS    0x0000000000000023
acid: stk()
main()+0x7 /usr/seh/repos/plan9/C/rot13.c:13
_main+0x40 /sys/src/libc/amd64/main9.s:15
acid: src(0x000000000020002f)
/usr/seh/repos/plan9/C/rot13.c:13
 8	{
 9		/* standard Biobuf at declaration time, &'s to pass pointers */
 10		Biobuf in, out;
 11	
 12		/* initialize our i/o, fd 0 is stdin, 1 is stdout, 2 is stderr, as is standard */
>13		if(Binit(&in, 0, OREAD) == Beof)
 14		{
 15			exits("Binit error with stdin");
 16		}
 17		if(Binit(&out, 1, OWRITE) == Beof)
 18		{
acid: 
echo kill > /proc/373906/ctl
echo kill > /proc/373897/ctl
tenshi% echo kill > /proc/373906/ctl
tenshi% echo kill > /proc/373897/ctl