(gdb) disas phase_f Dump of assembler code for function phase_f: 0x080487d0 <pha
ID: 3558256 • Letter: #
Question
(gdb) disas phase_f
Dump of assembler code for function phase_f:
0x080487d0
<phase_f+0>:
push
%ebp
0x080487d1
<phase_f+1>:
mov
%esp,%ebp
0x080487d3
<phase_f+3>:
sub
$0x28,%esp
0x080487d6
<phase_f+6>:
lea
-0x8(%ebp),%eax
0x080487d9
<phase_f+9>:
mov
%eax,0xc(%esp)
0x080487dd
<phase_f+13>:
lea
-0x4(%ebp),%eax
0x080487e0
<phase_f+16>:
mov
%eax,0x8(%esp)
0x080487e4
<phase_f+20>:
movl
$0x80490cf,0x4(%esp)
0x080487ec
<phase_f+28>:
mov
0x8(%ebp),%eax
0x080487ef
<phase_f+31>:
mov
%eax,(%esp)
0x080487f2
<phase_f+34>:
call
0x8048574 <sscanf@plt>
0x080487f7
<phase_f+39>:
mov
-0x4(%ebp),%edx
0x080487fa
<phase_f+42>:
mov
-0x8(%ebp),%eax
0x080487fd
<phase_f+45>:
cmp
%eax,%edx
0x080487ff
<phase_f+47>:
je
0x8048806 <phase_f+54>
0x08048801
<phase_f+49>:
call
0x8048f97 <explode_bomb>
0x08048806
<phase_f+54>:
leave
0x08048807
<phase_f+55>:
ret
End of assembler dump.
0x080487d0
<phase_f+0>:
push
%ebp
0x080487d1
<phase_f+1>:
mov
%esp,%ebp
0x080487d3
<phase_f+3>:
sub
$0x28,%esp
0x080487d6
<phase_f+6>:
lea
-0x8(%ebp),%eax
0x080487d9
<phase_f+9>:
mov
%eax,0xc(%esp)
0x080487dd
<phase_f+13>:
lea
-0x4(%ebp),%eax
0x080487e0
<phase_f+16>:
mov
%eax,0x8(%esp)
0x080487e4
<phase_f+20>:
movl
$0x80490cf,0x4(%esp)
0x080487ec
<phase_f+28>:
mov
0x8(%ebp),%eax
0x080487ef
<phase_f+31>:
mov
%eax,(%esp)
0x080487f2
<phase_f+34>:
call
0x8048574 <sscanf@plt>
0x080487f7
<phase_f+39>:
mov
-0x4(%ebp),%edx
0x080487fa
<phase_f+42>:
mov
-0x8(%ebp),%eax
0x080487fd
<phase_f+45>:
cmp
%eax,%edx
0x080487ff
<phase_f+47>:
je
0x8048806 <phase_f+54>
0x08048801
<phase_f+49>:
call
0x8048f97 <explode_bomb>
0x08048806
<phase_f+54>:
leave
0x08048807
<phase_f+55>:
ret
Explanation / Answer
You want to look at the format string passed to sscanf. Write the gdb command(s) to display this string.
Answer: x/s $esp+4
2.What are -8(%ebp) and -4(%ebp) used for? They are local variables, but be more speci?c than that.
The ebp are used to overwrite.They are the local variables. something accessible in C code that has a guaranteed fixed location relative to the current base pointer
3.(10 points) Let
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.