Jump to content

[HOWTO] GDB Debugging


Auntie Mangos

Recommended Posts

Is there anybody here, who can help me out? I am running Ubuntu server 64bits. I am using the restartscript one post up. But the logs are always empty.

1. GDB installed

2. configure with --with-debug-info

3. Loglevel 3 in mangos config file

4. ulimit == 0

restartscript + mangos-worldd are inside a Screen.

I really, really appreciate if someone can help me! Thanx in advance :)

edit: Nevermind got it working. In the script I just had to remove .* (core.*)

Link to comment
Share on other sites

  • 2 months later...

Need more information...which method are you using in the first place?

You can't force GDB to do anything if it has no input...if you're using core dumps, make sure they are actually created, and have expected names.

check ulimit and /proc/sys/kernel/core_pattern first...

Link to comment
Share on other sites

Need more information...which method are you using in the first place?

You can't force GDB to do anything if it has no input...if you're using core dumps, make sure they are actually created, and have expected names.

check ulimit and /proc/sys/kernel/core_pattern first...

OS: Ubuntu 64bit Server

Well I use a debug restarter script which I start with the following cmd:"screen -A -m -d -S debugrs ./debug.sh".

Here is the content of debug.sh:

LOGDIR="logs/"

LOG_LOG0="log_server" #destinationfile for your generallogs

LOG_ERR0="err_server" #destinationfile for your errorlogs

LOG_GDB0="gdb_server" #destinationfile for your crashlogs

LOG_LOG=$LOGDIR$LOG_LOG0

LOG_ERR=$LOGDIR$LOG_ERR0

LOG_GDB=$LOGDIR$LOG_GDB0

echo "run" > .core.gdb

echo "bt" >> .core.gdb

echo "bt full" >> .core.gdb

echo "thread apply all backtrace full" >> .core.gdb

while true

do

date=`date +%Y%m%d_%H.%M.%S`

gdb ./mangos -x .core.gdb --batch > $LOG_LOG".log" 2> $LOG_ERR".log"

gdb ./mangos -x .core.gdb --batch &>$LOG_LOG".log"

grep -B 40 -A 1800 "Program received signal SIG" $LOG_LOG".log" > $LOG_GDB$date".log"

mv $LOG_LOG".log" $LOG_LOG$date".log"

mv $LOG_ERR".log" $LOG_ERR$date".log"

rm $LOGDIR"last_"$LOG_LOG0".log"

ln -s $LOG_LOG$date".log" "last_"$LOG_LOG0".log"

rm $LOGDIR"last_"$LOG_ERR0".log"

ln -s $LOG_ERR$date".log" "last_"$LOG_ERR0".log"

rm $LOGDIR"last_"$LOG_GDB0".log"

ln -s $LOG_GDB$date".log" "last_"$LOG_GDB0".log"

echo `date`" restarting"

sleep 20

done

It works quite acceptable except that the log dates don't fit always and that you can't see the output of the server console anymore (Except with tail -f). But sometimes it simply outputs nothing at all or creates only a empty file, the core itself is of course compiled in debug mode and most of the time it outputs the GDB logs.

Ulimit says "unlimited" I guess thats fine. "nano /proc/sys/kernel/core_pattern" is set to "core".

Any idea what could cause the issue that it outputs nothing or only empty files sometimes?

Link to comment
Share on other sites

so you don't use core dumps anyway...and i have no idea why you are running mangos in gdb twice in the loop, or why you set the date before running it...

Well the script was written like that and in the end only one server is running, though a better script which is less buggy would be welcome. For me it is only important to get a detailed output of GDB and not empty files sometimes when a unexpected crash appeared.

(And yes the 2nd app call was quite dumb)

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use