1 the following problem illustrates the way memory

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: that fall through. Homework Problem 3.34 [Category 2]: Switch statements are particularly challenging to reverse engineer from the object code. In the following procedure, the body of the switch statement has been removed. 1 2 3 4 5 6 7 8 9 10 11 int switch_prob(int x) { int result = x; switch(x) { /* Fill in code here */ } return result; } Figure 3.37 shows the disassembled object code for the procedure. We are only interested in the part of code shown on lines 4 through 16. We can see on line 4 that parameter x (at offset 8 relative to %ebp) is loaded into register %eax, corresponding to program variable result. The “lea 0x0(%esi),%esi” 3.16. SUMMARY 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 197 080483c0 <switch_prob>: 80483c0: 55 80483c1: 89 e5 80483c3: 8b 45 08 80483c6: 8d 50 ce 80483c9: 83 fa 05 80483cc: 77 1d 80483ce: ff 24 95 68 84 04 08 80483d5: c1 e0 02 80483d8: eb 14 80483da: 8d b6 00 00 00 00 80483e0: c1 f8 02 80483e3: eb 09 80483e5: 8d 04 40 80483e8: 0f af c0 80483eb: 83 c0 0a 80483ee: 89 ec 80483f0: 5d 80483f1: c3 80483f2: 89 f6 push mov mov le...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online