Core: Difference between revisions
No edit summary |
mNo edit summary |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
* Produce a corefile for a running process with <tt>gcore</tt>(1) | * Produce a corefile for a running process with <tt>gcore</tt>(1) | ||
* The RLIMIT_CORE [[rlimit]] specifies the maximum size of a corefile | * The RLIMIT_CORE [[rlimit]] specifies the maximum size of a corefile | ||
** Use 0 to disable corefile generation, and "unlimited" for no explicit restriction on coredump size. | |||
** [[pam]] might be setting a hard limit at login time. Check <tt>/etc/security/limits.conf</tt>. | |||
==FreeBSD== | ==FreeBSD== | ||
* sysctl <tt>kern.corefile</tt> controls naming mechanisms. See the <tt>core(5)</tt> man page. | * sysctl <tt>kern.corefile</tt> controls naming mechanisms. See the <tt>core(5)</tt> man page. | ||
| Line 15: | Line 16: | ||
==[[gcc]]== | ==[[gcc]]== | ||
(largely taken from the [http://valgrind.org/docs/manual/faq.html#faq.unhelpful Valgrind FAQ]) | |||
If they're not detailed enough, make sure you are compiling with -g to add debug information. And don't strip symbol tables (programs should be unstripped unless you run 'strip' on them; some libraries ship stripped). Also, -fomit-frame-pointer and -fstack-check can make stack traces worse. | |||
Some example sub-traces: | |||
* With debug information and unstripped (best): | |||
<pre>Invalid write of size 1 | |||
at 0x80483BF: really (malloc1.c:20) | |||
by 0x8048370: main (malloc1.c:9)</pre> | |||
* With no debug information, unstripped: | |||
<pre>Invalid write of size 1 | |||
at 0x80483BF: really (in /auto/homes/njn25/grind/head5/a.out) | |||
by 0x8048370: main (in /auto/homes/njn25/grind/head5/a.out)</pre> | |||
* With no debug information, stripped: | |||
<pre>Invalid write of size 1 | |||
at 0x80483BF: (within /auto/homes/njn25/grind/head5/a.out) | |||
by 0x8048370: (within /auto/homes/njn25/grind/head5/a.out) | |||
by 0x42015703: __libc_start_main (in /lib/tls/libc-2.3.2.so) | |||
by 0x80482CC: (within /auto/homes/njn25/grind/head5/a.out)</pre> | |||
* With debug information and -fomit-frame-pointer: | |||
<pre>Invalid write of size 1 | |||
at 0x80483C4: really (malloc1.c:20) | |||
by 0x42015703: __libc_start_main (in /lib/tls/libc-2.3.2.so) | |||
by 0x80482CC: ??? (start.S:81)</pre> | |||
* A leak error message involving an unloaded shared object: | |||
<pre>84 bytes in 1 blocks are possibly lost in loss record 488 of 713 | |||
at 0x1B9036DA: operator new(unsigned) (vg_replace_malloc.c:132) | |||
by 0x1DB63EEB: ??? | |||
by 0x1DB4B800: ??? | |||
by 0x1D65E007: ??? | |||
by 0x8049EE6: main (main.cpp:24)</pre> | |||