1. Basic command
1 Enter GDB #gdb test
Test is the program to debug, generated by GCC test.c-g-o test. Enter the back-prompt into (GDB).
2) View Source (GDB) L
The source code will be the line number hint.
If you need to see the functions defined in other files, add the
(250));Value returned is $6 = 31375(GDB) C Continuing.RESULT[1-250] = 31375 Program exited with code 027. (GDB) Q Hchen/test>Well, with the above perceptual knowledge, or let us have a systematic understanding of gdb it.Using GDB————In general, GDB is mainly debugging the C
knowledge, or let us have a systematic understanding of gdb it.Using GDB————In general, GDB is mainly debugging the C + + program. In order to debug a C + + program, first at compile time, we have to add debug information to the executable file. This can be done
GDB is a powerful UNIX program debugging tool released by the GNU open-source organization. If you are working on a UNIX platform, you will find that the GDB debugging tool has more powerful functions than the visual debugger of VC and BCB. At the same time, GDB also has a graphical debugging end such as ddd. In general, GDB
To debug a program that is already running
Under UNIX, use PS to see the PID (Process ID) of the running program, and then use
the GDB PID format to hook up the running program.
First, using GDB to
correlate the source code, and GDB,
Once you use GDB to hang up the debugger, when the program is running, you can change the running line of the currently debugged program or the value of its variable dynamically in GDB according to your debugging idea, this powerful function can let you debug your program better, for example, You can go through all the branches of the program in one run of the pr
In general, GDB accomplishes the following four main functions:
(1) Start your program, you can follow your custom requirements to run the program at will.(2) allows the program to be debugged to stop at the breakpoint where you specified the reset. (Breakpoint can be a conditional expression)(3) When the program is stopped, you can check what happens in your program at this time.(4) Dynamically change the execution environment of your program.
1. In
=, prototype = 0x0, Num_args = 3, required_ Num_args = 2, Arg_info = 0x8ae7554, handler = 0x842691d You can also add monitoring watch, set some debug variable set, etc. Other debugging tools include strace to view system calls, Ltrace to view class library calls, vld view opcode Reference articles Http://www.cprogramming.com/gcc.html http://www.thegeekstuff.com/2010/03/debug-c-program-
Change the execution of a program———————
Once you use GDB to hang the debugger, and when the program is running, you can dynamically change the current debugger's running circuit or its variable value in GDB based on your own debugging ideas, a powerful feature that allows you to better debug your program, for example, You can walk through all the branches of th
The following article goes from Chenhao csdn blog: http://blog.csdn.net/haoel/article/details/2879
Overview of GDB commands———————Once GDB is started, you can start debugging with GDB's commands, as soon as you are brought into GDB's debug environment, and GDB commands can be viewed
() at tst.c:24printf ("result[1-250] =%d/n", func (250));Value returned is $6 = 31375(GDB) C Continuing.RESULT[1-250] = 31375 Program exited with code 027. (GDB) Q Hchen/test> Well, with the above perceptual knowledge, or let us have a systematic understanding of gdb it. Using G
] = 31375 Program exited with code 027. (GDB) Q Hchen/test>Well, with the above perceptual knowledge, or let us have a systematic understanding of gdb it.Using GDB————In general, GDB is mainly debugging the C + + program. In order to debug a C + + program, we need to add the
Program exited with code 027. (GDB) Q Hchen/test>Well, with the above perceptual knowledge, or let us have a systematic understanding of gdb it.Using GDB————In general, GDB is mainly debugging the C + + program. In order to debug a C + + program, we need to add the
are roughly the same. The most common practice is to debug applications. Debugging is performed using gdb + gdbserver. In many cases, users need to debug an application repeatedly, especially complex programs. The GDB method is used for debugging. Due to limited embedded sy
/test>Well, with the above perceptual knowledge, or let us have a systematic understanding of gdb it.Using GDB————In general, GDB is mainly debugging the C + + program. In order to debug a C + + program, we need to add the debug information to the executable file at the firs
Address: http://emacser.com/emacs-gdb.htm
1
Introduction
In addition to powerful editing functions, emacs can also be used as the front-end of the debugging tool GDB to debug the program. Emacs can be used for debugging. You can write and debug the program to Emacs and use the powerful functions of Emacs to assist debugging. emacs is an essential function for IDE
Use gtk programming 4 together (use GDB to debug the Program)
Reprinted please indicate the source: http://lvjinhua.cublog.cn
Author: lvjinhua at gmail dot com
2006.09.23
6. Use GDB to debug the program
Let's talk about how to use Makefile to organize the source code. This will briefly introduce how to use
Hchen/test>Well, with the above perceptual knowledge, or let us have a systematic understanding of gdb it.Using GDB————In general, GDB is mainly debugging the C + + program. In order to debug a C + + program, first at compile time, we have to add debug information to the ex
completed by a number of machine instructions, STEPI and Nexti can step into the machine instructions. The same function as the command is "display/i $pc", when the command is finished, the single-step tracking will be typed in the program code while the machine instructions (that is, assembly code)ix. Signal (signals)A signal is a soft interrupt and is a method of handling asynchronous events. In general, the operating system supports many signals. In particular, UNIX, a more important applica
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:
[email protected]
and provide relevant evidence. A staff member will contact you within 5 working days.