SLIDE 36 switch machine code
x86 Control Flow 40
00000000004004f6 <switch_eg>: . . . 4004fd: 77 2b ja 40052a <switch_eg+0x34> 4004ff: ff 24 fd d0 05 40 00 jmpq *0x4005d0(,%rdi,8) switch_eg: . . . cmpq $6, %rdi ja .L8 jmp *.L4(,%rdi,8)
Assembly Code Disassembled Object Code
Inspect jump table contents using GDB.
Examine contents as 7 addresses
(gdb) x/7a 0x4005d0
0x4005d0: 0x40052a <switch_eg+52> 0x400506 <switch_eg+16> 0x4005e0: 0x40050e <switch_eg+24> 0x400518 <switch_eg+34> 0x4005f0: 0x40052a <switch_eg+52> 0x400521 <switch_eg+43> 0x400600: 0x400521 <switch_eg+43> Address of code for case 0 Address of code for case 1 Address of code for case 6