GDB Learning-checkpoint,watch

Source: Internet
Author: User

Checkpoint's content reference:

Http://blog.chinaunix.net/uid-23629988-id-2943273.html

This article is mainly checkpoint, before next add checkpoint command, then you can use restart to restore to the previous checkpoint, you can avoid the beginning.

You can see all the checkpoints with info checkpoints.

Looks like you can see breakpoint.

(GDB) Info checkpoints 1 2060 0x80483e7  -  0 2059 0x80483f7  *

Watch watching

http://simohayha.iteye.com/blog/493091

Watch is a change in monitoring variables. Watch expr [thread Threadno] is a change to the variable only for this thread.

Rwatch is read for variables, Awatch is changed or read for variables.

Break is a breakpoint

Tbreak is a one-time breakpoint.

Break location if condition is condition true, it will only take effect if you arrive at this location.

Rbreak is a breakpoint with a regex.

The catch event takes effect when the event occurs,

These events include: throw, catch, exception, exception unhandled, assert, exec, fork, vfork, etc.

Tcatch refers to a disposable catch.

A breakpoint (including Watchpoint and Catchpoint) can have the following four states . :

Open, off, enabled once,enabled for deletion

Each corresponds to the following:

Disable [Breakpoints][range ...] Closes the specified breakpoint or all breakpoints (if there is no range)

Enable [Breakpoints][range] to open the specified breakpoint or all breakpoints (if no range)

The Enable [breakpoints] once range temporarily opens the specified breakpoint (that is, a one-time,.

The Enable [breakpoints] Delete range temporarily opens the specified breakpoint and works only once, after which the breakpoint is deleted.

Clear to delete the breakpoint,

Clear location, most commonly used is:

Clear function, clear file:function, clear linenum, clear file:linenum.

The difference between clear and delete is that clear is given a travel number or function, and delete is the breakpoint number.

condition can be used as a command in addition to following the break: Break condition

Contidition Bnum expression When expression is true, the program arrives at the breakpoint before it stops.

Contidition Bnum Removes a condition from the breakpoint Bnum.

Ignore Bnum count sets a breakpoint bnum the number of ignored counts. That is, the breakpoint only works after Count times.

You can also bring a sequence of commands in the break:

 Break 403 commands /// don't output anything. Silent /// change the value of x Set 4 /// then continue contend

Use commands + END to achieve

Step [Count]

Add count, which is step multiple times, and stops if a breakpoint is encountered.

Next [Count]
Similar to step, the difference is that the function is not followed .

Step behavior is controlled by Step-mode:

    1. Set Step-mode
    2. Set Step-mode on
    3. Set Step-mode off

On allows step to stop at the first instruction of the function without the debug information. Off is to execute the function directly.

It is important to note that the above commands are just jumping one line of code. Rather than an instruction.

Stepi is the execution instruction. Nexti, too.

GDB can monitor any signal in your program.

GDB Learning-checkpoint,watch

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.