1 00000000 : %ebp %esp,%ebp Ox8(%ebp),%eax Oxc(%ebp),%ecx (%eax,%eax,4),%eax Ox4 (%ecx,%eax,4),%eax Oxb8 (%ecx),%edx (%ecx),%edx %edx,0x8(%ecx,%eax,4) %ebp 0: 55 push 3 1: 89 e5 mov 4 3: 8b 45 08 mov 5 6: 8b 4d Oc mov 6 9: 8d 04 80 lea 7 C: 03 44 81 04 add 8 10: 8b 91 b8 0o 00 00 mov 16: 03 11 add 10 18: 89 54 81 08 mov 11 1с: 5d pop 12 1d: c3 ret Figure 3.45 Disassembled code for Problem 3.66. The declarations of the compile-time constant CNT and the structure a_struct are in a file for which you do not have the necessary access privilege. Fortunately, you have a copy of the .o' version of code, which you are able to disassemble with the OBJDUMP program, yielding the disassembly shown in Figure 3.45. Using your reverse engineering skills, deduce the following. A. The value of CNT. B. A complete declaration of structure a_struct. Assume that the only fields in this structure are idx and x. 2.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Computer Systems: A Programmer's Perspective
339
/ 1078
267%
+
3.66
You are charged with maintaining a large C program, and you come across the
following code:
1
typedef struct {
2
int left;
a_struct a [CNT];
int right;
3
4
5
} b_struct;
7
void test (int i, b_struct *bp)
8
{
bp->left + bp->right;
&bp->a[i];
9.
int n =
10
a_struct *ap =
ap->x [ap->idx] = n;
11
12
}
II
Transcribed Image Text:Computer Systems: A Programmer's Perspective 339 / 1078 267% + 3.66 You are charged with maintaining a large C program, and you come across the following code: 1 typedef struct { 2 int left; a_struct a [CNT]; int right; 3 4 5 } b_struct; 7 void test (int i, b_struct *bp) 8 { bp->left + bp->right; &bp->a[i]; 9. int n = 10 a_struct *ap = ap->x [ap->idx] = n; 11 12 } II
Computer Systems: A Programmer's Perspective
340
/ 1078
231%
+
1
00000000 <test>:
%ebp
%esp,%ebp
Ox8(%ebp),%eax
Oxc (%ebp),%ecx
(%eax,%eax,4),%eax
2
0:
55
push
1:
89 e5
mov
4
3:
8b 45 08
mov
6:
8b 4d Oc
mov
9:
8d 04 80
lea
Ох4 (%eсx, %eaах, 4) ,%eax
Oxb8 (%ecx),%edx
(%ecx),%edx
%edx,0x8 (%ecх,%eax,4)
%ebp
03 44 81 04
8b 91 b8 00 00 00
7
C:
add
8
10:
mov
16:
03 11
add
10
18:
89 54 81 O8
mov
11
1c:
5d
роp
12
1d:
c3
ret
Figure 3.45 Disassembled code for Problem 3.66.
The declarations of the compile-time constant CNT and the structure a_struct
are in a file for which you do not have the necessary access privilege. Fortunately,
you have a copy of the .o' version of code, which you are able to disassemble with
the OBJDUMP program, yielding the disassembly shown in Figure 3.45.
Using your reverse engineering skills, deduce the following.
A. The value of CNT.
B. A complete declaration of structure a_struct. Assume that the only fields
in this structure are idx and x.
II
Transcribed Image Text:Computer Systems: A Programmer's Perspective 340 / 1078 231% + 1 00000000 <test>: %ebp %esp,%ebp Ox8(%ebp),%eax Oxc (%ebp),%ecx (%eax,%eax,4),%eax 2 0: 55 push 1: 89 e5 mov 4 3: 8b 45 08 mov 6: 8b 4d Oc mov 9: 8d 04 80 lea Ох4 (%eсx, %eaах, 4) ,%eax Oxb8 (%ecx),%edx (%ecx),%edx %edx,0x8 (%ecх,%eax,4) %ebp 03 44 81 04 8b 91 b8 00 00 00 7 C: add 8 10: mov 16: 03 11 add 10 18: 89 54 81 O8 mov 11 1c: 5d роp 12 1d: c3 ret Figure 3.45 Disassembled code for Problem 3.66. The declarations of the compile-time constant CNT and the structure a_struct are in a file for which you do not have the necessary access privilege. Fortunately, you have a copy of the .o' version of code, which you are able to disassemble with the OBJDUMP program, yielding the disassembly shown in Figure 3.45. Using your reverse engineering skills, deduce the following. A. The value of CNT. B. A complete declaration of structure a_struct. Assume that the only fields in this structure are idx and x. II
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY