Dump of assembler code for function phase_6:
0x08048cdf <phase_6+0>: push %ebp
0x08048ce0 <phase_6+1>: mov %esp,%ebp
0x08048ce2 <phase_6+3>: push %edi
0x08048ce3 <phase_6+4>: push %esi
0x08048ce4 <phase_6+5>: push %ebx
0x08048ce5 <phase_6+6>: sub $0x3c,%esp
0x08048ce8 <phase_6+9>: lea -0x24(%ebp),%eax
0x08048ceb <phase_6+12>: mov %eax,0x4(%esp)
0x08048cef <phase_6+16>: mov 0x8(%ebp),%eax
0x08048cf2 <phase_6+19>: mov %eax,(%esp)
0x08048cf5 <phase_6+22>: call 0x8049393 <read_six_numbers>
0x08048cfa <phase_6+27>: mov $0x0,%ebx
0x08048cff <phase_6+32>: mov -0x24(%ebp,%ebx,4),%eax
0x08048d03 <phase_6+36>: sub $0x1,%eax
0x08048d06 <phase_6+39>: cmp $0x5,%eax
0x08048d09 <phase_6+42>: jbe 0x8048d10 <phase_6+49>
0x08048d0b <phase_6+44>: call 0x8049351 <explode_bomb>
0x08048d10 <phase_6+49>: lea 0x1(%ebx),%edi
0x08048d13 <phase_6+52>: cmp $0x6,%edi
0x08048d16 <phase_6+55>: jne 0x8048d29 <phase_6+74>
0x08048d18 <phase_6+57>: mov $0x804a5fc,%ecx
0x08048d1d <phase_6+62>: mov $0x1,%eax
0x08048d22 <phase_6+67>: mov $0x0,%edx
0x08048d27 <phase_6+72>: jmp 0x8048d52 <phase_6+115>
0x08048d29 <phase_6+74>: lea -0x24(%ebp,%ebx,4),%esi
0x08048d2d <phase_6+78>: mov %edi,%ebx
0x08048d2f <phase_6+80>: mov -0x28(%ebp,%edi,4),%eax
0x08048d33 <phase_6+84>: cmp 0x4(%esi),%eax
0x08048d36 <phase_6+87>: jne 0x8048d3d <phase_6+94>
0x08048d38 <phase_6+89>: call 0x8049351 <explode_bomb>
0x08048d3d <phase_6+94>: add $0x1,%ebx
0x08048d40 <phase_6+97>: add $0x4,%esi
0x08048d43 <phase_6+100>: cmp $0x5,%ebx
0x08048d46 <phase_6+103>: jle 0x8048d2f <phase_6+80>
0x08048d48 <phase_6+105>: mov %edi,%ebx
0x08048d4a <phase_6+107>: jmp 0x8048cff <phase_6+32>
0x08048d4c <phase_6+109>: mov 0x8(%ecx),%ecx
0x08048d4f <phase_6+112>: add $0x1,%eax
0x08048d52 <phase_6+115>: cmp -0x24(%ebp,%edx,4),%eax
0x08048d56 <phase_6+119>: jl 0x8048d4c <phase_6+109>
0x08048d58 <phase_6+121>: mov %ecx,-0x3c(%ebp,%edx,4)
0x08048d5c <phase_6+125>: add $0x1,%edx
0x08048d5f <phase_6+128>: cmp $0x5,%edx
0x08048d62 <phase_6+131>: jg 0x8048d70 <phase_6+145>
0x08048d64 <phase_6+133>: mov $0x804a5fc,%ecx
0x08048d69 <phase_6+138>: mov $0x1,%eax
---Type <return> to continue, or q <return> to quit---
0x08048d6e <phase_6+143>: jmp 0x8048d52 <phase_6+115>
0x08048d70 <phase_6+145>: mov -0x3c(%ebp),%ecx
0x08048d73 <phase_6+148>: mov -0x38(%ebp),%eax
0x08048d76 <phase_6+151>: mov %eax,0x8(%ecx)
0x08048d79 <phase_6+154>: mov -0x34(%ebp),%edx
0x08048d7c <phase_6+157>: mov %edx,0x8(%eax)
0x08048d7f <phase_6+160>: mov -0x30(%ebp),%eax
0x08048d82 <phase_6+163>: mov %eax,0x8(%edx)
0x08048d85 <phase_6+166>: mov -0x2c(%ebp),%edx
0x08048d88 <phase_6+169>: mov %edx,0x8(%eax)
0x08048d8b <phase_6+172>: mov -0x28(%ebp),%eax
0x08048d8e <phase_6+175>: mov %eax,0x8(%edx)
0x08048d91 <phase_6+178>: movl $0x0,0x8(%eax)
0x08048d98 <phase_6+185>: mov %ecx,%ebx
0x08048d9a <phase_6+187>: mov $0x0,%esi
0x08048d9f <phase_6+192>: mov 0x8(%ebx),%edx
0x08048da2 <phase_6+195>: mov (%ebx),%eax
0x08048da4 <phase_6+197>: cmp (%edx),%eax
0x08048da6 <phase_6+199>: jge 0x8048dad <phase_6+206>
0x08048da8 <phase_6+201>: call 0x8049351 <explode_bomb>
0x08048dad <phase_6+206>: mov 0x8(%ebx),%ebx
0x08048db0 <phase_6+209>: add $0x1,%esi
0x08048db3 <phase_6+212>: cmp $0x5,%esi
0x08048db6 <phase_6+215>: jne 0x8048d9f <phase_6+192>
0x08048db8 <phase_6+217>: add $0x3c,%esp
0x08048dbb <phase_6+220>: pop %ebx
0x08048dbc <phase_6+221>: pop %esi
0x08048dbd <phase_6+222>: pop %edi
0x08048dbe <phase_6+223>: pop %ebp
0x08048dbf <phase_6+224>: ret
End of assembler dump.
(gdb) disas 0x804a5fc
Dump of assembler code for function node1:
0x0804a5fc <node1+0>: jbe 0x804a601 <node1+5>
0x0804a5fe <node1+2>: add %al,(%eax)
0x0804a600 <node1+4>: add %eax,(%eax)
0x0804a602 <node1+6>: add %al,(%eax)
0x0804a604 <node1+8>: lock movsl %ds:(%esi),%es:(%edi)
0x0804a606 <node1+10>: add $0x8,%al
End of assembler dump.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
by: demi-osPosted on 2009-05-17 at 12:50:18ID: 24407366
It looks like you should single step the whole thing, well at least you should place a breakpoint before the explode_bomb and see what does it compare at a4, i am not sure, but it doesnt really seems to compare actual numbers you entered.
Also, as you already know, 0x08048d52 looks like "while ( cnt < array_of_int[idx] )" that is inside of while (true) that you may want to single step as well.
Select allOpen in new window