(gdb) info threads (gdb) thread 1 Thread ID 1 not known. Use the 'info threads' command to see the IDs of currently known threads. The GDB thread debugging facility allows you to observe all threads while your program runs-but whenever GDB takes control, one.
This question already has an answer here:
- How do I analyze a program's core dump file with GDB when it has command-line parameters? 9 answers
What are all the things I will need to check while analyzing core dump file?Please tell me from scratch.
user966588
DewDew
marked as duplicate by hichris123, bjb568, Andy♦, Ajay S, juanchopanzaSep 23 '14 at 9:35
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
2 Answers
You just need a binary (with debugging symbols included) that is identical to the one that generated the core. Then you can run
gdb path/to/the/binary path/to/the/core
to debug it.When it starts up, you can use
bt
(for backtrace) to get a stack trace from the time of the crash. In the backtrace, each function invocation is given a number. You can use frame number
(replacing number with the corresponding number in the stack trace) to select a particular stack frame. You can then use list
to see code around that function, and info locals
to see the local variables. You can also use print name_of_variable
(replacing 'name_of_variable' with a variable name) to see its value.Typing
help
within GDB will give you a prompt that will let you see additional commands.Michael Aaron SafyanMichael Aaron Safyan
Steps to debug coredump using GDB:
Some generic help:
gdb start GDB, with no debugging les
gdb program begin debugging program
gdb program core debug coredump core produced by program Skyrim using bodyslide and sg textures mod.
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 variable-name
or p variable-name
6- To get any help on GDB, use the
help
option or use apropos search-topic
7- Use
frame frame-number
to go to the 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
.MayankMayank
Not the answer you're looking for? Browse other questions tagged gdbcoredump or ask your own question.
GDB, short for GNU Debugger, is the most popular debugger for UNIX systems to debug C and C++ programs.
This tutorial provides a brief introduction on how to use GDB commands to ensure the programs are error-free.
A debugger is regarded as the best friend of a software programmer. Hence, this tutorial will be useful for all those programmers who would like to develop robust and error-free programs.
This tutorial assumes that you already know how to program in C and C++ and that you can compile and execute programs.