Stack trace
First edit a program
Compile with GCC, then debug with GDB and find GDB has not been downloaded
Re-run gdb after download
Set Breakpoint: B + line number or "main"
Run: R
Frame: The printed information: the stack's layer number, the current function name, the function parameter value, the file and line number where the function is located, and the statement to which the function executes.
Info frame: Print out information: function address, call function address, called function address, current function is written by what program language, function parameter address and value, local variable address and so on.
Input command disassemble: Shows the assembly form of the Code (main ())
Info registers, displays the current (main ()) Register value
Use the S to run the program in one step
Use up down to jump to different stacks and query the stack brief information in them
In this code, there are over 3 stacks, and the details of each stack are queried, and the stack changes are observed:
Stack formed by the main function (#2)
Stack (#1) formed by the F1 function:
Stack (#0) formed by the G1 function:
In this code, there are over 3 stacks, and the details of each stack are queried, and the stack changes are observed:
20145234 Huangfei "Fundamentals of Information Security system design" GDB debug assembler Stack Process analysis (1)