Question: For a C function switcher with the general structure gcc generates the assembly code and jump table shown in Figure 3.24. Fill in the missing

For a C function switcher with the general structure

void switcher (long a, long b, long c, long *dest) { } long val; switch (a) { case case val = break; case

gcc generates the assembly code and jump table shown in Figure 3.24.

Fill in the missing parts of the C code. Except for the ordering of case labels C and D, there is only one way to fit the different cases into the template.

Figure 3.24

(a) Code 1 2 3 4 5 6 7 8 10 11 12 13 14 15 16 17 18 19 20 1 2 void switcher(long a, long b, long c, long

void switcher (long a, long b, long c, long *dest) { } long val; switch (a) { case case val = break; case case C = /* Fall through */ val = break; case val = break; default: val= /* Case A */ } *dest = val; /* Case B */ /* Case C */ /* Case D */ /* Case E */

Step by Step Solution

3.46 Rating (149 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The key to reverse engineering compiled switch statements is to combine the ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Systems A Programmers Perspective Questions!