20145234 Huangfei "Fundamentals of Information Security system design" GDB debug assembler Stack Process analysis (1)

Source: Internet
Author: User
Tags stack trace

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.