Summary of Common commands for GDB debugging in Linux, and Common commands for gdb

Source: Internet
Author: User

Summary of Common commands for GDB debugging in Linux, and Common commands for gdb

Prepared by: longshike

Email: longshike2010@163.com

2016-01-05

Gdb is the default debugging tool in Linux. When compiling a program file, such as debug. c. To use gdb for debugging, you must add cc-g or gcc-g before the terminal command to compile debug. c can be obtained using the following command:

gcc -g -o debug debug.c

Enter gdb to the debugging environment.

Help displays help information.

Run to start running the program.

Backtrace supports stack tracing. When backtrace n or bt n is a positive integer, information of the Top n layers of the stack is printed. When n is a negative integer, information of the bottom n layers of the stack is printed.

Print can check the value of the current variable

List can display the current program content.

The break n is the row number. You can set the breakpoint.

Info breakpoints displays all breakpoints.

Delet breakpoints n can delete breakpoints.

Disable/enable breakpoints n can be disabled or breakpoint Enabled

Step [count]: If no count is specified, the program continues to be executed until the source file is different from the current source file. If count is specified, the process is repeated for count.

Next [count]. If no count is specified, the next program is executed. If count is specified, the next program is executed.

Continue [ignore-count] wakes up the program and continues until the next breakpoint or program ends. If ignore-count is specified, the ignore-count breakpoint is ignored.

 

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.