Linux Base 2--gdb Debugger

Source: Internet
Author: User
Tags gdb debugger

General steps used by the GDB debugger (constantly updated and perfected):

1, the compilation process to use the-G parameter to add debug symbols--GCC test.c-g;

2, gdb start executable file--gdb a.out;

3, the appearance of the GDB symbol indicates a successful start;

4, "L" (small L) command can see whether the current code is to execute the code;

5. Breakpoints

b line number/function name-function is the program execution will automatically pause at the breakpoint, waiting for instructions

Info b--View Breakpoint List

D Number--delete the breakpoint with the specified number

6. Execution procedure

R Enter--the program starts, executes to the first breakpoint at the code where it pauses

7. Single Step execution

N executes a statement, and if the next statement is a function, the skip function continues execution;

s executes a statement that, if the next statement is a function, enters into the function to step inside;

8. View variable values

P Variable name--view the value in the current variable

Change the current variable value set var variable name = new value

9. Exit the current debugging environment

Command "Q"

Linux Base 2--gdb Debugger

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.