| Rev | Author | # | Line |
|---|---|---|---|
| 4 | AlastairPorter | 1 | Under [Unix] style operating systems, when a program faults in some way ([SIGSEGV],[SIGABRT],etc...) and permissions allow (the [PWD|pwd(1)] is writable, ulimit(1)'s permit), then the kernel will write out a copy of the program's address space, as well as the state of all the registers and any other state that's required to a file, usually called "core" or "core.''programname''".%%% |
| 2 | To change the name of the core file on linux, look at <tt>/proc/sys/kernel/core_pattern</tt> | ||
| 1 | PerryLorier | 3 | |
| 3 | JohnMcPherson | 4 | Programs such as gdb(1) can then parse these core files and give you some indication about /why/ the program crashed. |
| 4 | AlastairPorter | 5 | <pre> |
| 1 | PerryLorier | 6 | strings core | grep ^_= |
| 4 | AlastairPorter | 7 | </pre> |
| 2 | AristotlePagaltzis | 8 | or |
| 4 | AlastairPorter | 9 | <pre> |
| 2 | AristotlePagaltzis | 10 | file core |
| 4 | AlastairPorter | 11 | </pre> |
| 12 | will usually tell you what program caused the core file. | ||
| 13 | |||
| 14 | <pre> | ||
| 15 | 13:06 < alastair> I tried head core | ||
| 16 | 13:06 < alastair> but gave up soon after that | ||
| 17 | 13:07 < Isomer> you kinda want tail | ||
| 18 | 13:07 < Isomer> since argv~[0] is near the top of the address space, not the | ||
| 19 | bottom | ||
| 20 | 13:07 < Isomer> but finding argv~[0] is just annoying without properly parsing | ||
| 21 | the entire core file | ||
| 22 | 13:08 < Isomer> so grepping the environment for the value of "_" (the current | ||
| 23 | command) is the easiest approach | ||
| 24 | </pre> | ||
| 25 | |||
| 26 | You can then use | ||
| 27 | <pre> | ||
| 3 | JohnMcPherson | 28 | gdb ''program'' core |
| 4 | AlastairPorter | 29 | </pre> |
| 2 | AristotlePagaltzis | 30 | |
| 3 | JohnMcPherson | 31 | gdb has several commands you can use to inspect the core file, however the most useful of them is |
| 4 | AlastairPorter | 32 | <pre> |
| 3 | JohnMcPherson | 33 | (gdb) bt full |
| 4 | AlastairPorter | 34 | </pre> |
| 1 | PerryLorier | 35 | |
| 3 | JohnMcPherson | 36 | this will usually display enough information that a programmer can figure out why the program crashed. When emailing a bug report to a programmer about a program that crashed, including a full backtrace (as per the previous command) will greatly improve the chances that the programmer will be able to find and fix the bug you encountered. |
| 1 | PerryLorier | 37 | |
| 3 | JohnMcPherson | 38 | See the DeBugging page for more information and hints about gdb. |
lib/blame.php:177: Warning: Invalid argument supplied for foreach() (...repeated 4 times)