In the debugger, pausing a program to run is necessary, and GDB can easily suspend the program. You can set the program to stop in which line, under what conditions to stop, in the receipt of what signal to stop and so on. To make it easier for you to view run-time variables and the run-time process.
When the process is stopped by GDB, you can use the Info program to see if the application is running, the process number, and why it was paused.
In GdB, we can have several pauses: breakpoints (breakpoint), observation points (Watch point), capture points (C++atch point), signals (signals), Thread stops (http://www.aliyun.com/ Zixun/aggregation/29914.html ">thread Stops). If you want to restore the program to run, you can use the C or re-enters command.
Set breakpoints (break Points)
We use the break command to set the breakpoint. Here are a few ways to set breakpoints:
Break <function>
Stops while entering the specified function. In C + +, you can use the class::function or function (type,type) format to specify the functions name.
Break <linenum>
Stop at the specified line number.
Break +offset Break-offset
Stop at the offset line either before or after the current line number. Offiset is the natural number.
Break Filename:linenum
Stop at the LineNum line at the source file filename.
Break Filename:function
Stop at the entrance of the function function of filename file.
Break *address
Stop at the memory address where the program is running.
Break
When the break command has no parameters, it means to stop at the next command.
Break ... if <condition>
... Can be the above parameters, condition to express conditions, when the conditions are set to stop. For example, in the loop body, you can set the break if i=100 to stop the program when I is 100. When viewing breakpoints, you can use the info command as follows: (Note: n indicates a breakpoint number)
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.