How to generate coredump file and debug it in GDB
1. ulimit-A can view all current limit
2. ulimit-C is used to set coredump. For example: ulimit-C unlimited, the size of the generated coredump file is not limited. You can also use ulimit-C 1024 to set the coredump file size to not exceed 1 MB.
3. After the program crash is run, the core file is generated. At this point:
GDB <program> <corefile>
You can also directly run GDB and enter core <corefile> in the command line of GDB.
By default, GDB prints the function calls and causes for crash, such:
#0 0xb7ca729b in strlen () from/lib/tls/i686/cmov/libc. so.6
This indicates that the strlen function call has a problem.
Then run the BT command to print the function call Stack:
(GDB) BT
#0 0xb7ca729b in strlen () from/lib/tls/i686/cmov/libc. so.6
#1 0xb7e028ce in g_strdup () from/usr/lib/libglib-2.0.so.0
#2 0xb7fe1180 in ?? () From/usr/lib/libgobject-2.0.so.0
#3 0xb7fbed20 in g_object_set_valist () from/usr/lib/libgobject-2.0.so.0
#4 0xb7fbf266 in g_object_set () from/usr/lib/libgobject-2.0.so.0
#5 0x0804c889 in maid (Data = 0xbfdcd644) at tester. C: 1092
#6 0xb7e0c02f in ?? () From/usr/lib/libglib-2.0.so.0
#7 0xb7d9550f in start_thread () from/lib/tls/i686/cmov/libpthread. so.0
#8 0xb7d117ee in clone () from/lib/tls/i686/cmov/libc. so.6
This is clear, from the bottom up is the function call stack. The problem clearly lies in g_object_set. This function is called in the stst_pipeline_func function.
Therefore, using the core file is of great help to the debug program.