Command line arguments are passed to int main(int argc, char** argv) as arguments argc and argv. You should assume that argc is at ebp+8 and argv is at ebp+12. This program is invoked from the command line as shown: ./program 5 7 The procedure named what is called from main, and returns to main with the value:   Options: a) 11 b) 66

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Topic Video
Question
100%

Command line arguments are passed to int main(int argc, char** argv) as arguments argc and argv. You should assume that argc is at ebp+8 and argv is at ebp+12.

This program is invoked from the command line as shown:

./program 5 7

The procedure named what is called from main, and returns to main with the value:

 

Options:

a) 11

b) 66

20
21 <main>
22 <main+4>
Өx4(%esp),%eсx
$0xfffffff0,%esp
-0x4 (%eсx)
%ebp
%esp,%ebp
lea
and
23 <main+7>
pushl
24 <main+10> push
25 <main+11>
26 <main+13>
mov
push
push
%ebx
27 <main+14>
%есх
28 <main+15>
$0x10,%esp
%есх,%ebx
Өx4(%ebx),%eаx
$0x4,%eax
(%eax),%eaх
$0xc,%esp
sub
29 <main+18>
mov
30 <main+20>
31 <main+23>
mov
add
32 <main+26>
mov
33 <main+28>
sub
34 <main+31>
35 <main+32>
push
%eax
<atoi@plt>
$0x10,%esp
%eax,-0xc(%ebp)
Оx4(%ebx),%eax
$0x8,%eax
(%eax),%eax
$0xc,%esp
call
36 <main+37>
add
37 <main+40>
mov
38 <main+43>
mov
39 <main+46>
40 <main+49>
add
mov
41 <main+51>
sub
push
call
42 <main+54>
%eax
43 <main+55>
44 <main+60>
<atoi@plt>
$0x10,%esp
%eax,-0x10(%ebp)
-0x10 (%ebp),%eax
Өx1(%eаx),%edx
-0xс(%ebp), %eax
$0x2,%eax
$0x8,%esp
add
45 <main+63>
mov
46 <main+66>
mov
47 <main+69>
48 <main+72>
lea
mov
49 <main+75>
add
50 <main+78>
sub
51 <main+81>
push
push
call
%edx
52 <main+82>
53 <main+83>
%eax
<what>
54 <main+88>
$0x10,%esp
%eax,-0x14(%ebp)
$0x0,%eax
-0x8(%ebp),%esp
add
55 <main+91>
mov
56 <main+94>
mov
57 <main+99>
58 <main+102> рор
59 <main+103> роp
60 <main+104> роp
lea
%ecx
%ebx
%ebp
-0x4(%eсx),%esp
61 <main+105> lea
62 <main+108> ret
63 |
Transcribed Image Text:20 21 <main> 22 <main+4> Өx4(%esp),%eсx $0xfffffff0,%esp -0x4 (%eсx) %ebp %esp,%ebp lea and 23 <main+7> pushl 24 <main+10> push 25 <main+11> 26 <main+13> mov push push %ebx 27 <main+14> %есх 28 <main+15> $0x10,%esp %есх,%ebx Өx4(%ebx),%eаx $0x4,%eax (%eax),%eaх $0xc,%esp sub 29 <main+18> mov 30 <main+20> 31 <main+23> mov add 32 <main+26> mov 33 <main+28> sub 34 <main+31> 35 <main+32> push %eax <atoi@plt> $0x10,%esp %eax,-0xc(%ebp) Оx4(%ebx),%eax $0x8,%eax (%eax),%eax $0xc,%esp call 36 <main+37> add 37 <main+40> mov 38 <main+43> mov 39 <main+46> 40 <main+49> add mov 41 <main+51> sub push call 42 <main+54> %eax 43 <main+55> 44 <main+60> <atoi@plt> $0x10,%esp %eax,-0x10(%ebp) -0x10 (%ebp),%eax Өx1(%eаx),%edx -0xс(%ebp), %eax $0x2,%eax $0x8,%esp add 45 <main+63> mov 46 <main+66> mov 47 <main+69> 48 <main+72> lea mov 49 <main+75> add 50 <main+78> sub 51 <main+81> push push call %edx 52 <main+82> 53 <main+83> %eax <what> 54 <main+88> $0x10,%esp %eax,-0x14(%ebp) $0x0,%eax -0x8(%ebp),%esp add 55 <main+91> mov 56 <main+94> mov 57 <main+99> 58 <main+102> рор 59 <main+103> роp 60 <main+104> роp lea %ecx %ebx %ebp -0x4(%eсx),%esp 61 <main+105> lea 62 <main+108> ret 63 |
1 <what>
%ebp
%esp,%ebp
$0x10,%esp
Өx8(%ebp),%eax
$0x4,%eax
%eax,-0x4(%ebp)
Оx8(%ebp),%eax
Оxc(%ebp),%eax
%eax,-0x8(%ebp)
Оx8(%ebp),%eax
Өxc (%ebp),%eax
%eax,-0xc(%ebp)
-0x4(%ebp),%edx
-өx8(%ebp),%eax
%eax,%edx
-0хс (%ebp), %eax
%edx,%eax
push
2 <what+1>
mov
3 <what+3>
sub
4 <what+6>
mov
5 <what+9>
add
6 <what+12>
mov
7 <what+15>
mov
8 <what+18> imul
9 <what+22>
mov
10 <what+25>
mov
11 <what+28>
sub
12 <what+31>
mov
13 <what+34>
mov
14 <what+37>
mov
15 <what+40>
add
16 <what+42>
mov
17 <what+45>
add
18 <what+47> leave
19 <what+48>
ret
20
Transcribed Image Text:1 <what> %ebp %esp,%ebp $0x10,%esp Өx8(%ebp),%eax $0x4,%eax %eax,-0x4(%ebp) Оx8(%ebp),%eax Оxc(%ebp),%eax %eax,-0x8(%ebp) Оx8(%ebp),%eax Өxc (%ebp),%eax %eax,-0xc(%ebp) -0x4(%ebp),%edx -өx8(%ebp),%eax %eax,%edx -0хс (%ebp), %eax %edx,%eax push 2 <what+1> mov 3 <what+3> sub 4 <what+6> mov 5 <what+9> add 6 <what+12> mov 7 <what+15> mov 8 <what+18> imul 9 <what+22> mov 10 <what+25> mov 11 <what+28> sub 12 <what+31> mov 13 <what+34> mov 14 <what+37> mov 15 <what+40> add 16 <what+42> mov 17 <what+45> add 18 <what+47> leave 19 <what+48> ret 20
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education