Core dumps

Posted by Zeno on Thu 24 Feb 2011 06:05 PM — 7 posts, 28,740 views.

USA #0
I'm trying to remember how to get cores to dump.

I have C code which gets compiled and run like a MUD, but it's threaded (which makes gdb difficult).

I'm not getting any cores being dumped.

ulimit:
core file size        (blocks, -c) 16384
data seg size         (kbytes, -d) unlimited
file size             (blocks, -f) unlimited
max locked memory     (kbytes, -l) unlimited
max memory size       (kbytes, -m) unlimited
open files                    (-n) 1024
pipe size          (512 bytes, -p) 8
stack size            (kbytes, -s) 8192
cpu time             (seconds, -t) unlimited
max user processes            (-u) 7168
virtual memory        (kbytes, -v) unlimited


Makefile uses -D_REENTRANT -g -o execname -pthread -lm on obj files and -D_REENTRANT -c -g on source files

Or maybe my program isn't seg faulting.
Amended on Thu 24 Feb 2011 06:08 PM by Zeno
Australia Forum Administrator #1
You're not sure if it's segfaulting? Is there no message?

How do threads stop gdb anyway? A quick Google seems to indicate it may be able to handle that.

Maybe your program is looping rather than seg faulting. Anyway, can you do a "ps" and see if it is running or not?
USA #2
I was getting reports that a players instance of the game crashed, so I was assuming it was segfaults.

The issue with threads is that I don't know which thread to attach to in gdb. Nor do I know what's causing the crash.

So I'm hoping to have core dumps.
USA #3
It's pretty easy to test if your environment is set up for core dumps: just write a program that should dump a core, like assert(0) or a null pointer deref or something.
USA #4
Environment is setup for cores dumping it seems.

Guess I need to figure out what this 11+ year old code is doing.
Australia Forum Administrator #5
People use the word "crash" in strange ways. I would get more details. For example, it might be looping.
USA #6
Well I have this cron that runs:
#!/bin/bash

ps x > /tmp/ps.txt
grep "phantasia/bin/phantasia" /tmp/ps.txt > /dev/null
rc=$?
now=`date`

if [ $rc != "0" ]
then
        nohup "phantasia/bin/phantasia" &
        echo "$now - started phantasia server" >> ~/game.log
else
        count=`grep "phantasia/bin/phantasia" /tmp/ps.txt | wc -l`
        let count="$count - 2"
        echo "$now - $count game(s) running" >> ~/game.log
#       vmstat 10 3 >> game.log
#       echo >> game.log
fi

rm /tmp/ps.txt
exit 0



Quote:
Sun Feb 27 07:45:01 EST 2011 - 1 game(s) running
Sun Feb 27 08:00:01 EST 2011 - started phantasia server
Sun Feb 27 08:15:01 EST 2011 - started phantasia server
Sun Feb 27 08:30:01 EST 2011 - 1 game(s) running


So it is dying, I just have to figure out in what way.