Question: 8 . You are charged with maintaining a large C program, and you come across the following code: ` ` ` typedef struct { int
You are charged with maintaining a large C program, and you come across the following code:
typedef struct
int first;
astruct aCNT;
int last;
bstruct;
void test long i bstruct bp
int n bpfirst bplast;
astruct ap &bpai;
apxapidx n;
The declarations of the compiletime constant CNT and the structure astruct 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 following disassembly:
void testlong i bstruct bp
i in rdi, bp in rsi
:
lc: c
: b e mov xCrsiecx
: e add rsiecx
: d bf lea rdi,rdi,rax
c: d c lea rsi,rax,rax
: b mov xraxrdx
: c movslq ecx,rcx
:c d mov rcxxrax, rdx
retq
Using your reverse engineering skills, deduce the following:
A The value of CNT
B The size of astruct and the size of bstruct.
C A complete declaration of structure astruct. Assume that the only fields in this structure are idx and x and that both of these contain signed values.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
