LINUX study note 7 -- use the GDB program debugging tool

Source: Internet
Author: User

I. GDB program debugging: A program debugging tool
 
1. functions:
 
A) start the program to be debugged
 
B) stop the program to be debugged at the specified position.
 
C) when the program is stopped, you can check the program status.
 
2. Use:
 
A) Compile the program gcc with the debugable tool-g
 
B) Start gdb: gdb program name
 
1. Method 2: Start gdb first, and then run the file name
 
C) Check the program: list (l): 10 rows and 10 rows
 
D) set a breakpoint at main: B main
 
1. break (B) Function Name:
 
2. B row number:
 
3. B file name: row number
 
4. B row number if condition
 
5. View All Breakpoints: info break
 
6. delete a breakpoint: The delete breakpoint number.
 
E) run gdb: run (r ):
 
F) One-step operation: next: Do not enter the subfunction
 
1. View variable value: print variable name
 
G) One-step operation: step: Enter the sub-function
 
H) continue running: continue (c)
 
I) fully run: run the function finish until the current function ends.
 
J) monitoring variable: watch variable name
 
K) Exit: quit (q)

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.