debugging a crash

Everything related to the code /
Tout ce qui touche au code
Post Reply
User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

debugging a crash

Post by zuzuf » Sun Jul 13, 2008 8:27 pm

I spent several hours trying to fix the crash that (often) occurs when you enter in skirmish menu from the single player menu. It crashes because of hash table objects. It seems there is some initialization/cleaning bug over there but I still don't know where :cry: .
=>;-D Penguin Powered

milipili
Posts: 545
Joined: Thu Nov 02, 2006 8:52 am
Location: Paris (France)
Contact:

Post by milipili » Sun Jul 13, 2008 8:41 pm

I never had any crash at this stade. Could you provide a GDB backtrace ?
Damien Gerard
Ta3d & Yuni Developer

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Mon Jul 14, 2008 2:36 pm

here is the whole backtrace:

Code: Select all

#0  0x00002b5ad3d2aa55 in raise () from /lib64/libc.so.6
#1  0x00002b5ad3d2c1e0 in abort () from /lib64/libc.so.6
#2  0x00002b5ad3d640fb in std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream () from /lib64/libc.so.6
#3  0x00002b5ad3d6b4ba in std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::~basic_ostringstream () from /lib64/libc.so.6
#4  0x00002b5ad3d6f11c in free () from /lib64/libc.so.6
#5  0x00002b5ad36058ee in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string$base () from /usr/lib64/libstdc++.so.6
#6  0x00000000004a5933 in ~String (this=0x7fffd8f84668)
    at /home/roland/jeux/ta3d/trunk/src/misc/../misc/string.h:223
#7  0x00000000004bc133 in ~binder2nd (this=0x7fffd8f84660)
    at /usr/lib/gcc/x86_64-manbo-linux-gnu/4.2.3/../../../../include/c++/4.2.3/bits/stl_function.h:429
#8  0x00000000004bdcc9 in TA3D::UTILS::cHashTable<TA3D::String>::InsertOrUpdate
    (this=0x2076270, key=@0x7fffd8f84990, v=@0x7fffd8f84980)
    at /home/roland/jeux/ta3d/trunk/src/misc/hashtable.hxx:113
#9  0x00000000004bb4dd in TA3D::UTILS::cTAFileParser::ProcessData (
    this=0x2076270, Data=0x7fffd8f84f58)
    at /home/roland/jeux/ta3d/trunk/src/cTAFileParser.cpp:124
#10 0x00000000004bae28 in TA3D::UTILS::cTAFileParser::ProcessData (
    this=0x2076270, Data=0x7fffd8f84f58)
    at /home/roland/jeux/ta3d/trunk/src/cTAFileParser.cpp:85
---Type <return> to continue, or q <return> to quit---
#11 0x00000000004bbd00 in TA3D::UTILS::cTAFileParser::load (this=0x2076270,
    FileName=@0x7fffd8f85680, bClearTable=false, toUTF8=false, g_mode=false)
    at /home/roland/jeux/ta3d/trunk/src/cTAFileParser.cpp:193
#12 0x00000000004bbe26 in cTAFileParser (this=0x2076270,
    FileName=@0x7fffd8f85680, bKeysCaseSenstive=false, toUTF8=false,
    g_mode=false) at /home/roland/jeux/ta3d/trunk/src/cTAFileParser.cpp:253
#13 0x00000000005ef8a4 in TA3D::SKIN::load_tdf (this=0x2075f00,
    filename=@0x7fffd8f85680, scale=1)
    at /home/roland/jeux/ta3d/trunk/src/gfx/gui/skin.cpp:95
#14 0x0000000000609857 in TA3D::AREA::doLoadTDF (this=0x7fffd8f86280,
    filename=@0x7fffd8f869f0)
    at /home/roland/jeux/ta3d/trunk/src/gfx/gui/area.cpp:208
#15 0x000000000060a95f in TA3D::AREA::load_tdf (this=0x7fffd8f86280,
    filename=@0x7fffd8f869f0)
    at /home/roland/jeux/ta3d/trunk/src/gfx/gui/area.cpp:195
#16 0x00000000004d2fb3 in setup_game (client=false, host=0x0)
    at /home/roland/jeux/ta3d/trunk/src/menu.cpp:640
#17 0x0000000000573c36 in TA3D::Menus::Solo::doGoMenuSkirmish (
    this=0x7fffd8f87a50)
    at /home/roland/jeux/ta3d/trunk/src/ingame/menus/solo.cpp:97
#18 0x0000000000574088 in TA3D::Menus::Solo::maySwitchToAnotherMenu (
    this=0x7fffd8f87a50)
    at /home/roland/jeux/ta3d/trunk/src/ingame/menus/solo.cpp:89
---Type <return> to continue, or q <return> to quit---
#19 0x0000000000572794 in TA3D::Menus::Abstract::doLoop (this=0x7fffd8f87a50)
    at /home/roland/jeux/ta3d/trunk/src/ingame/menus/base.cpp:87
#20 0x00000000005727d2 in TA3D::Menus::Abstract::doExecute (
    this=0x7fffd8f87a50)
    at /home/roland/jeux/ta3d/trunk/src/ingame/menus/base.cpp:97
#21 0x0000000000572722 in TA3D::Menus::Abstract::doGuardExecute (
    this=0x7fffd8f87a50)
    at /home/roland/jeux/ta3d/trunk/src/ingame/menus/base.cpp:49
#22 0x0000000000572ba8 in TA3D::Menus::Abstract::execute (this=0x7fffd8f87a50)
    at /home/roland/jeux/ta3d/trunk/src/ingame/menus/base.cpp:23
#23 0x00000000005742a5 in TA3D::Menus::Solo::Execute ()
    at /home/roland/jeux/ta3d/trunk/src/ingame/menus/solo.cpp:26
#24 0x00000000005717d2 in TA3D::Menus::MainMenu::goToMenuSolo (
    this=0x7fffd8f87c20)
    at /home/roland/jeux/ta3d/trunk/src/ingame/menus/mainmenu.cpp:166
#25 0x0000000000571b05 in TA3D::Menus::MainMenu::maySwitchToAnotherMenu (
    this=0x7fffd8f87c20)
    at /home/roland/jeux/ta3d/trunk/src/ingame/menus/mainmenu.cpp:132
#26 0x0000000000572794 in TA3D::Menus::Abstract::doLoop (this=0x7fffd8f87c20)
    at /home/roland/jeux/ta3d/trunk/src/ingame/menus/base.cpp:87
#27 0x000000000057126e in TA3D::Menus::MainMenu::doExecute (
    this=0x7fffd8f87c20)
    at /home/roland/jeux/ta3d/trunk/src/ingame/menus/mainmenu.cpp:70
---Type <return> to continue, or q <return> to quit---
#28 0x0000000000572722 in TA3D::Menus::Abstract::doGuardExecute (
    this=0x7fffd8f87c20)
    at /home/roland/jeux/ta3d/trunk/src/ingame/menus/base.cpp:49
#29 0x0000000000572ba8 in TA3D::Menus::Abstract::execute (this=0x7fffd8f87c20)
    at /home/roland/jeux/ta3d/trunk/src/ingame/menus/base.cpp:23
#30 0x00000000005721d1 in TA3D::Menus::MainMenu::Execute ()
    at /home/roland/jeux/ta3d/trunk/src/ingame/menus/mainmenu.cpp:29
#31 0x00000000004b0c55 in main (argc=1, argv=0x7fffd8f87dd8)
    at /home/roland/jeux/ta3d/trunk/src/main.cpp:304
but keep in mind that it crashes in random places in the code ... and something strange if I reload/delete skins 100 times when I load them it greatly reduce the probability to have such a crash :shock:
=>;-D Penguin Powered

milipili
Posts: 545
Joined: Thu Nov 02, 2006 8:52 am
Location: Paris (France)
Contact:

Post by milipili » Mon Jul 14, 2008 3:09 pm

Hum your OS is 64bits. That would explain why I have never crash from that part.
Damien Gerard
Ta3d & Yuni Developer

milipili
Posts: 545
Joined: Thu Nov 02, 2006 8:52 am
Location: Paris (France)
Contact:

Post by milipili » Mon Jul 14, 2008 3:17 pm

The method ProcessData seems buggy. When using proper types to use with strings TA3D simply does not work.
Damien Gerard
Ta3d & Yuni Developer

milipili
Posts: 545
Joined: Thu Nov 02, 2006 8:52 am
Location: Paris (France)
Contact:

Post by milipili » Mon Jul 14, 2008 3:25 pm

s/seems/is :D
Damien Gerard
Ta3d & Yuni Developer

milipili
Posts: 545
Joined: Thu Nov 02, 2006 8:52 am
Location: Paris (France)
Contact:

Post by milipili » Mon Jul 14, 2008 3:45 pm

Could you try the r853 ?
The problem may be somewhere else if nothing changes
Damien Gerard
Ta3d & Yuni Developer

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Mon Jul 14, 2008 7:38 pm

ok, I found what was crashing the game. It wasn't 64 bits specific ... the RAM cache used in by the HPI module wasn't returning null terminated buffers as expected, so when the cTAFileParser was reading those buffers, it went past the end which produced nasty things ...

It might also fix some other strange things related to memory corruption (among them I hope it fixes texture corruption under OS X).
=>;-D Penguin Powered

milipili
Posts: 545
Joined: Thu Nov 02, 2006 8:52 am
Location: Paris (France)
Contact:

Post by milipili » Tue Jul 15, 2008 8:24 am

I will confirm that in one week. But it is not finished yet on OS X anyway. I can still see the output of my terminal on the water :D
Sorry ^^
Damien Gerard
Ta3d & Yuni Developer

Post Reply

Who is online

Users browsing this forum: No registered users and 30 guests