GDB function summary in Linux system

  

In Linux system operation, GDB is a program debugging tool, and has a variety of functions, the following small series will give you a detailed introduction to the functions of GDB, so that you have GDB A detailed understanding.

Perhaps, you like the graphical interface, VC, BCB and other IDE debugging, but if you are doing software on the UNIX platform, you will find that GDB debugging tools have better than VC, BCB More powerful features of the graphical debugger. The so-called "small length, short ruler" is this truth. In general, GDB mainly helps you to complete the following four aspects:

Start your program, you can run the program as you want, according to your custom requirements.

Allows the program being debugged to stop at the breakpoint of the call you specified. (A breakpoint can be a conditional expression.)

When the program is stopped, you can check what happens in your program at this time.

Dynamically change the execution environment of your program.

From the above point of view, GDB is no different from the general debugging tools, basically it is to complete these functions, but in the details, you will find that GDB is a powerful debugging tool, you may be used to graphical Debugging tools, but sometimes the command-line debugging tools have features that graphical tools can't. Let us look at it one by one.

gdb list of basic commands:

Example:

1 Create a source file vi swap.cc

source files as follows :

#include

using namespace std;

void swap(int &a,int &b)

{

int tmp;

tmp=a;

a=b;

b=tmp;

}

int main( )

{

int i,j;

cout

cin》i》》j;

cout "Before swap(),i=”"

3.Start debugging gdb swap
Previous1234Next page Total 4 pages

Copyright © Windows knowledge All Rights Reserved