Linux Application Development-gdb debugging

Source: Internet
Author: User

Linux application Development-gdb debugging a gdb concept


GDB is the GNU-developed Linux debugging tool


Two basic use Process


1 Entering the debugger mode: Gcc-g test.c-o test.out


2 opening gdb:gdb Test.out


3 Running the program: Run (R)


4 exit: Quit (q)


5 You can also go to gdb before you execute file load to debug files


Three basic commands


1 setting Breakpoints: Break (b) line number or breaking (b) file name: line number items for multiple C files



2 Viewing Breakpoints: info break or I D


3 Delete breakpoint: Delete (d) Number of breakpoint


4 stepping does not enter child functions: Next (N)


5 stepping into the sub-function: Step (s)


6 continuing the execution of the program, not only stepping: Continue (c)


7 Print the value of a variable: print num or P num or print function value print fun


8 Set the value of the variable: set var = value


9 Viewing programs: List (L)


10 loading the executable file to be debugged: file test.c


11 terminating the program being debugged: Kill test.c


12 viewing the type of variable: Whatis num


13 Do not exit GDB re-generate executable file: Make


14 Do not exit GDB execution shell command: Shell


15 Exit Gdb:quit (q)


Linux Application Development-gdb debugging

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.