GD debug command, gdb Debug Core file

Source: Internet
Author: User

Using the gcc-g test.c-o test.out compiler, only the plus-G parameter supports GDB debugging;

Then gdb./test.out runs the executable file, enters gdb debug mode (GDB), and enters the command after the parentheses;

(GDB) Help: View command assistance

(GDB) Start: single-line execution

(GDB) L: View source program

(GDB) N: Executes the next line

(GDB) S: Inside the modulated function

(GDB) bt: view function Call stack

(GDB) p variable: Print variable Value

(GDB) F: Toggle function Stack Frame

(GDB) Run: Start the file again

(GDB) Finish: Ends the current function and returns to the function call point

(GDB) Q: Exit GDB

(GDB) Enter: Executes the previous command

To debug a core file:

Find out what's happening in the core first unknown: Find $HOME-name Core

Then go to the directory where the core occurs, and you can use File + directory assist to locate which executable is the report core

Then execute the GDB + executable file

(GDB) Where: you can see which line is wrong

GD debug command, gdb Debug Core file

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.