I am writing some CPP code that runs as part of Apache. I have a segfault. Where would I find the core dump so I can debug this. If there is no core dump, how do I tell Apache to create one (is there a debug flag?)
Asked
Active
Viewed 949 times
0
-
I hope you're using `-X` for your apache debugging session. It makes it MUCH easier to debug apache when you directly launch the process inside your debugger rather than relying just on logged output, core files, or hunting down the running process to attach to (which is a real bear for startup faults). I dunno if that feature is a Windows-only thing, but it is a life-saver if you can use it. – WhozCraig Jan 16 '13 at 16:19
1 Answers
3
Whether a core is dumped or not is set via ulimit -c
. It's not up to the application to decide whether to dump core or not (a core is generated by the OS, not the app, which has perished at that point already).
A corefile should be located in the directory from which the application was started.
A core can / will be dumped whether the application is a debug version or not. (Of course, a core dump of a non-debug version is somewhat less helpful due to the lack of debugging symbols in the process image.)

DevSolar
- 67,862
- 21
- 134
- 209
-
so, if I do /usr/local/apache2/bin/apachectl start. I should expect to see the core dump in /usr/local/apache2/bin ? – Itay Moav -Malimovka Jan 16 '13 at 16:15
-
The location is actually configurable, see: http://stackoverflow.com/questions/2065912/core-dumped-but-core-file-is-not-in-current-directory – hexist Jan 16 '13 at 16:19
-
The core is dumped to the *working directory*. By default, that's the one you were in when you called `/usr/local/apache2/bin/apachectl`. The process can `cwd` out of there, and in case of Apache, will try to do so to dump the core in the directory specified as `CoreDumpDirectory` in the Apache configuration. Whether or not that succeeds is up to your system / config, of course... – DevSolar Jan 16 '13 at 16:20