Core dumped problem lookup and using GDB, QT under Gdbserver

Source: Internet
Author: User
Tags server port

One, what is Coredump

We often hear people say that the program core dropped, need to locate the solution, most of this refers to the corresponding program due to various anomalies or bugs in the process of abnormal exit or abort, and under certain conditions (why do we need to meet certain conditions?) The following analysis will produce a file called core.

Typically, the core file contains the program runtime memory, register state, stack pointers, memory management information and various function call stack information, we can understand that the program is the current state store to generate the first file, many of the program error will produce a core file, Through the tool analysis of this file, we can locate the program when the exception exits the corresponding stack call information, identify the problem and timely resolution.

Second, the storage location of the Coredump file

The default storage location of the core file and the corresponding executable program in the same directory, the file name is the core, you can see the following command where the core file exists:

Cat/proc/sys/kernel/core_pattern

The default value is the core

III. Generation of Coredump files

1. Specify the build path of the core dumped file

Console input Command:

/sbin/sysctl-w kernel.core_pattern=/home/james/workspace/bin/core_%t_%e_%p

%t-insert Unix time, the coredump occurred into filename when you add a core file when you build Unix

%e-insert coredumping executable name into filename Add class name

%p-insert pid into filename add PID (Process ID)

2, set the core dumped file size is not limited

Console input Command:

Gedit ~/.BASHRC

At the end of the file, add:

Ulimit-c Unlimited

3. When the program quits unexpectedly, view the core dumped file

Console input Command:

GDB Execute core_ (dump file)

You can use the TAB key to complete

Enter

where

View the stack of functions that resulted in the last thread being rolled out.

Iv. use of QT and Gdbserver (this is done on PC)

Target machine: (Port customization)

192.168. 1.119:1234  ./execute

Guest Host:

Qtcreator-> Debug (Debug)-Start Debugging (Start Debugging), associating to a remote debugging server (Attach to remotely debug server ...) Enter the start debugger interface,

Enter port 1234 on server ports (server port)

In the override Srever address input ip:192.168.1.119

Execute locally when (local executable) Select executable: Execute

Click OK to Debug.

Core dumped problem lookup and using GDB, QT under Gdbserver

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.