GDB corresponding VC debug command

Source: Internet
Author: User
Tags comparison table

GDB VC Debug Comparison table:

Implementing the function VC GDB

Modified to compile F7 make

Jump function (step out) shift+f11 finish,f

Restart Ctrl+shift+f5 run,r

Run to the specified line F9+f5 TBREAK,TB + continue,c

Interrupt program Ctrl+alt+break CTRL + C

Continue running F5 after an outage continue,c

Single step after interruption can not next,n

Conditional interrupts cannot be implemented with multiple conditional setting methods (attached 1)

Watch variable condition variable right-click Add monitoring there are multiple cases of handling (attached 2)

View breakpoint Information Alt+f9 Info break,i b

Clear All Breakpoints Ctrl+shift+f9 Del,d

Clears the specified breakpoint mouse to the specified breakpoint F9 del to clear the breakpoint number

Jump out of loop after loop code except right click to run here Until,u (on For,while line)

View the variables in the function alt+4 info Local, where the display variable name can be observed in real time before leaving the function automatic printing does not run every time info local

View parameters mouse over parameters info Arg,info args

View Stack alt+7 break trace,bt when interrupted

View the relevant variable at a function in the stack mouse select frame +num (number in the stack), Up,down

Modify the variable value at a breakpoint directly in the variables window to modify the Set,s + variable name =xx

Attached 1:

Conditional interrupts cannot be implemented with multiple conditional setting methods (attached 1)

(1)

b if condition

such as b if i = = 1, or b if str= "ABC"

If the breakpoint is already set, info breaks to see the breakpoint number

Condition Breakpoint Number Condition

For example condition 1 NULL = = P

(2)

Breakpoint hit Count is counted, I B can view

You can set a breakpoint to be hit n times and then break

For example: Ignore 3 10

The 3rd breakpoint after running the above command and then hit 10 to interrupt, the default hit 0 times after the interruption, that is, each time interrupted

With this condition, you can break after the number of hits you want to see the variable situation, the error in the middle

The commissioning of the time is very helpful

Attached 2

Watch variable condition variable right-click Add monitoring there are multiple cases of handling (attached 2)

(1)

Watch variable or expression

It is equivalent to setting a hard breakpoint, and when the variable is modified it breaks the program and prints the value before and after the change.

An expression can be preceded by an address with a mandatory type, which is useful for variable monitoring that is not globally visible but has an invariant address

Some important tips:

(1) List file name: line number and B file name: line number These two commands need to be in B main; run is not valid

(2) B does not add what the thing means to set a breakpoint on the current line

(3) P local variable hint no symbol XX in current context error, compile option on-G based on the machine-o0 and-wall and-ggdb, such as CPP set: Cxx_flags =-o0-wall-g-ggdb

(4) List line number, function name, variable name is the default in the query the current active file, the current active file is the List file name or function name into the file, or after the interruption of the file, you can imagine the VC is currently open file, you can directly run the B line number above, also do not superfluous B file name Line number, but make sure the current active file is the file you want to set the breakpoint on.

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.