coredump - How to set breakpoints and make it break when debugging core dump with gdb? -
how set breakpoints , make break when debugging core dump gdb? when use command "gdb program core", process halt @ crash point, how can make process break before halting there. if cannot make break, commands can use in gdb when debugging core dump?
you can restart program once loading core if want trace steps leading crash. use 'start', take first line in program. set breakpoints between main() , crash point. see sample below:
<pre> [narz@dev101 src]$ gdb -n -quiet myprogram core.12046 reading symbols </my/path/>...done. [new thread 12046] reading symbols /usr/lib64/libstdc++.so.6...(no debugging symbols found)...done. loaded symbols /usr/lib64/libstdc++.so.6 reading symbols /lib64/libm.so.6...(no debugging symbols found)...done. loaded symbols /lib64/libm.so.6 reading symbols /lib64/libgcc_s.so.1...(no debugging symbols found)...done. loaded symbols /lib64/libgcc_s.so.1 reading symbols /lib64/libc.so.6...(no debugging symbols found)...done. loaded symbols /lib64/libc.so.6 reading symbols /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done. loaded symbols /lib64/ld-linux-x86-64.so.2 core generated `./myprogram'. program terminated signal 11, segmentation fault. #0 0x0000000000400658 in main () @ stack.cpp:6 6 int b=*x; (gdb) p x $1 = (int *) 0x0 (gdb) l 1 #include <iostream> 2 3 int main(void) 4 { 5 int* x=null; 6 int b=*x; 7 return 0; 8 } (gdb) start no core file now. temporary breakpoint 1 @ 0x40064c: file stack.cpp, line 5. starting program: /u03/narz/projects/xxxxx/xxxxx/src/myprogram temporary breakpoint 1, main () @ stack.cpp:5 5 int* x=null; (gdb) </pre>
Comments
Post a Comment