Chapter 3 practical content and code analysis:
I. Process:
Disassembly: objdump-d wsc. o
1. Create a c file of wsc1.c and convert it into assembly code:
WSC. C:
WSC. O :( view od xxx)
2. Enter the command to obtain the binary format code, and enter od wsc. O to view the Code:
Iii. disassembly: objdump-d wsc. O to obtain the disassembly code:
Iv. disassembly code analysis:
1. The disassembly Code has no suffix after the operation instruction compared with the general assembly code.
2. code analysis: the code logic is that the G function calls the f function, and the main function calls the G function. The first function is used as an example to analyze the stack frame through code:
G function: Call F in G. First save % EBP, set % EBP to the starting position of the stack frame, and subtract 8 from the stack pointer, it means that the stack is divided into eight more bytes (but only four bytes are used, and four bytes are useless ). Pass the value (y) relative to % EBP at the offset of-4 to % eax, transfer from % eax to % EDI, call f, and then the return address is pushed into the stack. F function: press a % EBP, set the % EBP position, and pass the % EDI value (y) to the position relative to the % EBP offset of-4, and then to % eax, overwrite the value of Y + 7 to % eax and pass it as the return value. % EBP is displayed, which controls the transfer back to G.
20145331 summary and code analysis of "Information Security System Design Basics" in week 5th