Java Noob
Java Noob

Reputation: 35

How do I make use of a core dump to find application problems in C/C++?

I don't have any idea how I could find the root cause of a C/C++ linux application's problem using the core files. I understand that core files are genereated when something unexpected happens to an application. But I don't know where to start. Can anybody give me a jump start?

Upvotes: -1

Views: 2473

Answers (1)

Mayank
Mayank

Reputation: 2210

Some generic help:

Install gdb using :

yum install gdb

gdb start GDB, with no debugging les

gdb program begin debugging program

gdb program core debug coredump core produced by program

gdb --help describe command line options

1- First of all find the directory where the corefile is generated. 2- Then use "ls -ltr" command in the directory to find the latest generated corefile. 3- To load the corefile use

gdb binary path of corefile

This will load the corefile.

4- Then you can get the information using "bt" command. For detailed backtrace use "bt full".

5- To print the variables use "print varibale-name" or " p varibale-name"

6- To get any help on gdb use "help" option or use "apropos search-topic"

7- Use "frame frame-number" to go to desired frame number.

8- Use "up n" and "down n" commands to select frame n frames up and select frame n frames down respectively.

9- To stop gdb use "quit" or "q".

Upvotes: 1

Related Questions