Script started on Mon Feb 11 22:14:42 2002 linux1% alias nasm /afs/umbc.edu/users/c/h/chang/pub/cs313/nasm linux1% nasm -f elf -l toupper.lst toupper.asm linux1% ld toupper.o linux1% a.out Enter string: abcde Original: abcde Convert: ABCDE linux1% linux1% a.out Enter string: Read error linux1% linux1% a.out Enter string: aB1$%#!$!#1 askdjfa;!@#$ Original: aB1$%#!$!#1 askdjfa;!@#$ Convert: AB1$%#!$!#1 ASKDJFA;!@#$ linux1% linux1% gdb a.out GNU gdb Red Hat Linux 7.x (5.0rh-15) (MI_OUT) Copyright 2001 Free Software Foundation, Inc. ... (no debugging symbols found)... (gdb) disassemble start Dump of assembler code for function start: 0x8048081 : mov $0x4,%eax 0x8048086 : mov $0x1,%ebx 0x804808b : mov $0x8049160,%ecx 0x8048090 : mov $0xe,%edx 0x8048095 : int $0x80 ... End of assembler dump. (gdb) set disassembly-flavor intel (gdb) disas start Dump of assembler code for function start: 0x8048081 : mov eax,0x4 0x8048086 : mov ebx,0x1 0x804808b : mov ecx,0x8049160 0x8048090 : mov edx,0xe 0x8048095 : int 0x80 ... End of assembler dump. (gdb) x/14cb &msg1 0x8049160 : 69 'E' 110 'n' 116 't' 101 'e' 114 'r' 32 ' ' 115 's' 116 't' 0x8049168 : 114 'r' 105 'i' 110 'n' 103 'g' 58 ':' 32 ' ' (gdb) break *start Breakpoint 1 at 0x8048081 (gdb) break *L1_init Breakpoint 2 at 0x80480d4 (gdb) break *L1_top Breakpoint 3 at 0x80480e4 (gdb) break *L1- _end Breakpoint 4 at 0x80480f7 (gdb) break *exit Breakpoint 5 at 0x8048151 (gdb) run Starting program: /afs/umbc.edu/users/c/h/chang/home/asm/lec05/a.out Breakpoint 1, 0x08048081 in start () (gdb) info registers eax 0x0 0 ecx 0x0 0 edx 0x0 0 ebx 0x0 0 esp 0xbffff940 0xbffff940 ebp 0x0 0x0 esi 0x0 0 edi 0x0 0 eip 0x8048081 0x8048081 eflags 0x246 582 cs 0x23 35 ss 0x2b 43 ds 0x2b 43 es 0x2b 43 fs 0x0 0 gs 0x0 0 fctrl 0x37f 895 fstat 0x0 0 ftag 0xffff 65535 fiseg 0x23 35 fioff 0x8057db0 134577584 foseg 0x2b 43 fooff 0xbfff5398 -1073785960 fop 0x77d 1917 xmm0 0x00000000000000000000000000000000 xmm1 0x00000000000000000000000000000000 xmm2 0x00000000000000000000000000000000 xmm3 0x00000000000000000000000000000000 xmm4 0x00000000000000000000000000000000 xmm5 0x00000000000000000000000000000000 xmm6 0x00000000000000000000000000000000 xmm7 0x00000000000000000000000000000000 mxcsr 0x1f80 8064 (gdb) print $eax $1 = 0 (gdb) stepi 0x08048086 in start () (gdb) print $eax $2 = 4 (gdb) si 0x0804808b in start () (gdb) print $ebx $3 = 1 (gdb) display/i $eip 1: x/i $eip 0x804808b : mov ecx,0x8049160 (gdb) si 0x08048090 in start () 1: x/i $eip 0x8048090 : mov edx,0xe (gdb) print $ecx $4 = 134517088 (gdb) print/x $ecx $5 = 0x8049160 (gdb) si 0x08048095 in start () 1: x/i $eip 0x8048095 : int 0x80 (gdb) nexti Enter string: 0x0804809c in start () 1: x/i $eip 0x804809c : mov ebx,0x0 (gdb) cont Continuing. abCDefGHi Breakpoint 2, 0x080480d4 in read_OK () 1: x/i $eip 0x80480d4 : mov ecx,ds:0x8049390 (gdb) disas read_OK L1_end Dump of assembler code from 0x80480d4 to 0x80480f7: 0x80480d4 : mov ecx,ds:0x8049390 0x80480da : mov esi,0x8049190 0x80480df : mov edi,0x8049290 0x80480e4 : mov al,BYTE PTR [esi] 0x80480e6 : inc esi 0x80480e7 : cmp al,0x61 0x80480e9 : jb 0x80480f1 0x80480eb : cmp al,0x7a 0x80480ed : ja 0x80480f1 0x80480ef : and al,0xdf 0x80480f1 : mov BYTE PTR [edi],al 0x80480f3 : inc edi 0x80480f4 : dec ecx 0x80480f5 : jne 0x80480e4 End of assembler dump. (gdb) cont Continuing. Breakpoint 3, 0x080480e4 in L1_top () 1: x/i $eip 0x80480e4 : mov al,BYTE PTR [esi] (gdb) print/c $eax $6 = 10 '\n' (gdb) print $ecx $7 = 10 (gdb) si 0x080480e6 in L1_top () 1: x/i $eip 0x80480e6 : inc esi (gdb) print  /c $eax $8 = 97 'a' (gdb) si 0x080480e7 in L1_top () 1: x/i $eip 0x80480e7 : cmp al,0x61 (gdb) si 0x080480e9 in L1_top () 1: x/i $eip 0x80480e9 : jb 0x80480f1 (gdb) si 0x080480eb in L1_top () 1: x/i $eip 0x80480eb : cmp al,0x7a (gdb) si 0x080480ed in L1_top () 1: x/i $eip 0x80480ed : ja 0x80480f1 (gdb) si 0x080480ef in L1_top () 1: x/i $eip 0x80480ef : and al,0xdf (gdb) si 0x080480f1 in L1_cont () 1: x/i $eip 0x80480f1 : mov BYTE PTR [edi],al (gdb) print $eax $9 = 65 (gdb) print/c $eax $10 = 65 'A' (gdb) si 0x080480f3 in L1_cont () 1: x/i $eip 0x80480f3 : inc edi (gdb) si 0x080480f4 in L1_cont () 1: x/i $eip 0x80480f4 : dec ecx (gdb) si 0x080480f5 in L1_cont () 1: x/i $eip 0x80480f5 : jne 0x80480e4 (gdb) si Breakpoint 3, 0x080480e4 in L1_top () 1: x/i $eip 0x80480e4 : mov al,BYTE PTR [esi] (gdb) si 0x080480e6 in L1_top () 1: x/i $eip 0x80480e6 : inc esi (gdb) print/c $eax $11 = 98 'b' (gdb) cont Continuing. Breakpoint 3, 0x080480e4 in L1_top () 1: x/i $eip 0x80480e4 : mov al,BYTE PTR [esi] (gdb) si 0x080480e6 in L1_top () 1: x/i $eip 0x80480e6 : inc esi (gdb) print/c $eax $12 = 67 'C' (gdb) si 0x080480e7 in L1_top () 1: x/i $eip 0x80480e7 : cmp al,0x61 (gdb) si 0x080480e9 in L1_top () 1: x/i $eip 0x80480e9 : jb 0x80480f1 (gdb) si 0x080480f1 in L1_cont () 1: x/i $eip 0x80480f1 : mov BYTE PTR [edi],al (gdb) cont Continuing. Breakpoint 3, 0x080480e4 in L1_top () 1: x/i $eip 0x80480e4 : mov al,BYTE PTR [esi] (gdb) display $ecx 2: $ecx = 7 (gdb) display/c $eax 3: /c $eax = 67 'C' (gdb) cont Continuing. Breakpoint 3, 0x080480e4 in L1_top () 3: /c $eax = 68 'D' 2: $ecx = 6 1: x/i $eip 0x80480e4 : mov al,BYTE PTR [esi] (gdb) cont Continuing. Breakpoint 3, 0x080480e4 in L1_top () 3: /c $eax = 69 'E' 2: $ecx = 5 1: x/i $eip 0x80480e4 : mov al,BYTE PTR [esi] (gdb) cont Continuing. Breakpoint 3, 0x080480e4 in L1_top () 3: /c $eax = 70 'F' 2: $ecx = 4 1: x/i $eip 0x80480e4 : mov al,BYTE PTR [esi] (gdb) cont Continuing. Breakpoint 3, 0x080480e4 in L1_top () 3: /c $eax = 71 'G' 2: $ecx = 3 1: x/i $eip 0x80480e4 : mov al,BYTE PTR [esi] (gdb) cont Continuing. Breakpoint 3, 0x080480e4 in L1_top () 3: /c $eax = 72 'H' 2: $ecx = 2 1: x/i $eip 0x80480e4 : mov al,BYTE PTR [esi] (gdb) cont Continuing. Breakpoint 3, 0x080480e4 in L1_top () 3: /c $eax = 73 'I' 2: $ecx = 1 1: x/i $eip 0x80480e4 : mov al,BYTE PTR [esi] (gdb) si 0x080480e6 in L1_top () 3: /c $eax = 10 '\n' 2: $ecx = 1 1: x/i $eip 0x80480e6 : inc esi (gdb) si 0x080480e7 in L1_top () 3: /c $eax = 10 '\n' 2: $ecx = 1 1: x/i $eip 0x80480e7 : cmp al,0x61 (gdb) si 0x080480e9 in L1_top () 3: /c $eax = 10 '\n' 2: $ecx = 1 1: x/i $eip 0x80480e9 : jb 0x80480f1 (gdb) si 0x080480f1 in L1_cont () 3: /c $eax = 10 '\n' 2: $ecx = 1 1: x/i $eip 0x80480f1 : mov BYTE PTR [edi],al (gdb) si 0x080480f3 in L1_cont () 3: /c $eax = 10 '\n' 2: $ecx = 1 1: x/i $eip 0x80480f3 : inc edi (gdb) si 0x080480f4 in L1_cont () 3: /c $eax = 10 '\n' 2: $ecx = 1 1: x/i $eip 0x80480f4 : dec ecx (gdb) si 0x080480f5 in L1_cont () 3: /c $eax = 10 '\n' 2: $ecx = 0 1: x/i $eip 0x80480f5 : jne 0x80480e4 (gdb) si Breakpoint 4, 0x080480f7 in L1_end () 3: /c $eax = 10 '\n' 2: $ecx = 0 1: x/i $eip 0x80480f7 : mov eax,0x4 (gdb) info breakpoints Num Type Disp Enb Address What 1 breakpoint keep y 0x08048081 breakpoint already hit 1 time 2 breakpoint keep y 0x080480d4 breakpoint already hit 1 time 3 breakpoint keep y 0x080480e4 breakpoint already hit 10 times 4 breakpoint keep y 0x080480f7 breakpoint already hit 1 time 5 breakpoint keep y 0x08048151 (gdb) disable breakpoint 5 (gdb) info display Auto-display expressions now in effect: Num Enb Expression 3: y /c $eax 2: y $ecx 1: y /1bi $eip (gdb) undisplay 2 (gdb) undisplay 3 (gdb) cont Continuing. Original: abCDefGHi Convert: ABCDEFGHI Program exited normally. (gdb) quit linux1% exit