Jump to content
×
×
  • Create New...

How To Use GDB for your game.core for Debug


YukiPowa

Recommended Posts

Hello!

I've never seen the above tutorial, yet useful!
Full application server administrator for help when they have a game.core without doubt that the answer is and precisely.

So here, the very easy, the command to type is:
gdb.

 

Exemple : gdb /usr/metin2/share/game /usr/metin2/channel1/game.core

 

This command will tell you where does the error through the .core.
Or at least it will help you to know or just the problem.

 

IMPORTANT: You must not have a game to strip debug!

 

Good bye :)

 

  • Love 3
Link to comment
Share on other sites

  • Replies 29
  • Created
  • Last Reply

Top Posters In This Topic

Thank you very much for sharing! :)

 

You can also run the gamefile with gdb.

This all requires that you're building your gamefile with debug support of course :) Otherwise backtracing can produce bad results.

 

gdb game

run

 

Then you can reproduce the bug and see what happens. gdb can help a lot when fixing game crashes :)

Link to comment
Share on other sites

  • Moon

Thank you very much for sharing! :)

 

You can also run the gamefile with gdb.

This all requires that you're building your gamefile with debug support of course :) Otherwise backtracing can produce bad results.

 

gdb game

run

 

Then you can reproduce the bug and see what happens. gdb can help a lot when fixing game crashes :)

 

Extra information ;

When your program is run via gdb and system give crash, gdb is stopped and show the line..

 

Kind Regards

Ken

  • Love 1

Do not be sorry, be better.

Link to comment
Share on other sites

You should note that FreeBSD is not really good with cross-platform compiling/debugging.

Since game files are usually compiled for x86 (32bit), debugging on an x86-64 machine is quite hard.

 

I usually use an x86 VM or server for debugging instead of messing with this issue.

Link to comment
Share on other sites

You should note that FreeBSD is not really good with cross-platform compiling/debugging.

Since game files are usually compiled for x84 (32bit), debugging on an x86-64 machine is quite hard.

 

I usually use an x86 VM or server for debugging instead of messing with this issue.

Interestingly we debug perfectly on a 64bit machine having a 32bit game compiled.

Link to comment
Share on other sites

  • Premium

I am building my game file using -g flag, but when I am trying to run the game using gdb I get the message: no debugging symbols found.

Also, if I am trying to use game.core it says that this file does not exists.

I am building the game under 32-bit machine and running it on a 64-bit machine. I don't have -s flag.

Link to comment
Share on other sites

I am building my game file using -g flag, but when I am trying to run the game using gdb I get the message: no debugging symbols found.

Also, if I am trying to use game.core it says that this file does not exists.

I am building the game under 32-bit machine and running it on a 64-bit machine. I don't have -s flag.

You need to read the core as i386 (x86). You can use:

set gnutarget i386-marcel-freebsd
file game
core game.core
[...]
  • Love 1
Link to comment
Share on other sites

  • Premium

 

I am building my game file using -g flag, but when I am trying to run the game using gdb I get the message: no debugging symbols found.

Also, if I am trying to use game.core it says that this file does not exists.

I am building the game under 32-bit machine and running it on a 64-bit machine. I don't have -s flag.

You need to read the core as i386 (x86). You can use:

set gnutarget i386-marcel-freebsd
file game
core game.core
[...]

 

I've tried under the same machine where I compiled the core and I got same messages.

Link to comment
Share on other sites

  • 3 weeks later...
  • Moon

if you use a x64 machine do this :

# gdb
(gdb) set gnutarget i386-marcel-freebsd

(gdb) file game
(gdb) core game.core
(gdb) bt full

(gdb) quit
#

PS : use

bt

to get a small amount of info (a summery) it can as well be help full with some info like the time in both syserr and syslog can pretty much clear your bug or give you a general idea about it.

edit :

thx to martysama0134

  • Love 3
Link to comment
Share on other sites

Extra information ;

When your program is run via gdb and system give crash, gdb is stopped and show the line..

 

Kind Regards

Ken

Isn't that totally obvious since we're talking about debugging? [likehunting intensifies]

Enough is enough

Link to comment
Share on other sites

 

 

Your machine virtual is x64 ?

 

Use x86

 

Thanks for answer, there's no other way to use in 64 bits?

 

look at my last post

 

 

When I write :

file /usr/server/share/bin/game it shows me the following error 

Reading symbols from /usr/server/share/bin/game...Dwarf Error: wrong version in compilation unit header (is 4, should be 2) 

 

Link to comment
Share on other sites

  • 2 months later...

Hey Everyone.

I have a question. What is now the best way to debug a game crash?

I want to debug it on a 64 Bit System...

I Try gdb but it not work.

Follow error appears:

GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...Dwarf Error: wrong version in compilation unit header (is 4, should be 2) [in module /usr/games/channel1/channel1_1/game1_1]

Thanks for any help! :)

Link to comment
Share on other sites

Would be nice to see errors which you get with new gdb. If it's the same, then try to compile the game without -O -O2 -O3 flags and with -g flag (you need to check each Makefile).

Furthermore I can advice you to make cmd file for gdb and start it with -x argument, gdb.cmd file should contains path to directories with source files, it will help to see  c++ code while debugging.

Example of my gdb.cmd

directory /root/workspace/mainline/extern/include/boost
directory /root/workspace/mainline/extern/include
directory /root/workspace/mainline/extern/lib
directory /root/workspace/mainline/src_gcc49/libdevil
directory /root/workspace/mainline/src_gcc49/liblua/include
directory /root/workspace/mainline/src_gcc49/libthecore/lib
directory /root/workspace/mainline/src_gcc49/libpoly
directory /root/workspace/mainline/src_gcc49/libsql
directory /root/workspace/mainline/src_gcc49/libgame/lib
directory /root/workspace/mainline/src_gcc49/liblua/lib
directory /root/workspace/mainline/src_gcc49/game/src
directory /root/workspace/mainline/src_gcc49/db/src

So after you can start gdb like this:

/usr/local/bin/gdb791 -x gdb.cmd

 

Also, as it was told before, do not forget set target architecture (set gnutarget i386-marcel-freebsd in case if binary is 32bit one)

Edited by wezt
  • Love 1
Link to comment
Share on other sites

Don't use Stipped gamefile...

@wezt don't can make a gdb.cmd because server run on 64Bit system and i compile on a 32Bit system.. don't know how to compile on 64 bit <.< so i can't link source..

 

But the "/usr/local/bin/gdb7x1" works very well!

 

Thaks

Edited by Benhero
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


Important Information

Terms of Use / Privacy Policy / Guidelines / 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.