[Freeciv-Dev] Re: How can I get a core dump?
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Thu, 15 Sep 2005, Christian Knoke wrote:
> I crashed civserver, but cannot find the core file.
>
> I start civclient from the panel of the Gnome desktop in Debian Sarge.
> .bashrc has ulimit -c unlimited
Make sure the current working directory of civclient is writable and there
is no 'core' file belongin to another user in that directory.
This can be achieved by either not using chdir() and starting in a
writable directory with no 'core' file or by setting up appropriate signal
handler.
Example:
--- snip --- snap
#include <signal.h>
void
signal_handler(int sig)
{
signal(SIGABRT, SIG_DFL);
chdir("/tmp");
abort();
}
int
main(void)
{
int i;
int x, y, z;
for (i = 0; i < 30; i++)
signal(i, signal_handler);
x = 1;
y = x-1;
z = x/y; /* crash it */
}
--- snip --- snap ---
On crash, this will chdir to /tmp (which should be writable as long there
is no core file with another owner) and dump a core there.
Regards,
Guido
|
|