Visual debugging of GDB in Linux

Source: Internet
Author: User

Get to one of the tricks of GDB debugging program under Linux today and share it with you! Usually we use the GCC programming, the program debugging, the observation program jumps and so on is not so intuitive. It's all in the interface!

But if we add the executable file generated by the-G command when we compile the connection, with Gdb-tui-q p2psrv (the command to debug), you can enter a similar visual debugging interface.

After believing that some basic GDB operations should be clear to everyone.

BackTrace: View function calls and parameters at all levels

Finish: run continuously until the current function returns, and then stop waiting for the command

frame (or F) Framing number: Select Stack Frame

info (or i) Locals: View the value of the current stack frame local variable

list (or L): lists the source code, followed by the last position, column 10 row at a time

List function Name: List The source code of a function

Next (N): Executes the next line of statements

Print (or P): Prints the value of the expression, which can be modified by the expression to modify the value of the variable or call the function

Quit (or Q): Exit GDB Debug Environment

Set VAR: Modifying the value of a variable

Start: Begin executing the program, stop waiting for the command before the first sentence of the main function

Step; Execute the next sentence and enter the function if there is a function call

You can try it now!  

Command Description
BackTrace (or BT) View function calls and parameters at all levels
Finish Run continuously until the current function returns, and then stop waiting for the command
FRAME (or F) Framing number Select Stack Frame
info (or i) locals View the value of the current stack frame local variable
List (or L) List the source code, followed by the last position, column 10 row at a time
List line number List source code starting from the first few lines
List function name List the source code for a function
Next (or N) Executes the next line of statements
Print (or P) Prints the value of an expression, through which the value of the variable can be modified or the function is called
Quit (or Q) Exiting the gdb debugging environment
Set Var Modifying the value of a variable
Start Start executing the program, stop main waiting for the command in front of the first line of the function statement
Step (or S) Executes the next line of statements and enters into the function if there is a function call

Visual debugging of GDB in Linux

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.