dougmencken / HeadOverHeels

The free and open source remake of the game “Head over Heels”

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

chat about old and new segmentation faults, and other stuff (:

attuska opened this issue · comments

tor1
tor2

The game now always ends in segmentation faults

Play 1.

> playing Ogg music/blacktooth.ogg
[Thread 0xcdb38b40 (LWP 20104) exited]
creation of behavior "behavior of disappearance in time" for free item "bubbles" at x=80 y=15 z=48 with orientation "nowhere"
creation of behavior "behavior of disappearance in time" for free item "bubbles" at x=80 y=63 z=48 with orientation "nowhere"
creation of behavior "behavior of disappearance in time" for free item "bubbles" at x=130 y=61 z=72 with orientation "nowhere"
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_M_create
>
>Thread 28 "headoverheels" received signal SIGABRT, Aborted.
[Switching to Thread 0xd282fb40 (LWP 20103)]
0xf7fd9a62 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
(gdb) bt
#0  0xf7fd9a62 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1  0xf7156dc0 in raise () from /lib/libc.so.6
#2  0xf7158287 in abort () from /lib/libc.so.6
#3  0xf744351f in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/../lib/libstdc++.so.6
#4  0xf74410d4 in __cxxabiv1::__terminate(void (*)()) () from /usr/lib/../lib/libstdc++.so.6
#5  0xf744114d in std::terminate() () from /usr/lib/../lib/libstdc++.so.6
#6  0xf7441401 in __cxa_throw () from /usr/lib/../lib/libstdc++.so.6
#7  0xf746beb6 in std::__throw_length_error(char const*) () from /usr/lib/../lib/libstdc++.so.6
#8  0xf74d8f10 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned int&, unsigned int) ()
   from /usr/lib/../lib/libstdc++.so.6

Play 2.

>   copy of character "heels" with behavior "behavior of Heels" is created to rebuild this room
[New Thread 0xd282fb40 (LWP 20244)]
>
>Thread 1 "headoverheels" received signal SIGSEGV, Segmentation fault.
0xf7f61340 in _linear_draw_sprite32 () from /usr/lib/../lib/liballeg.so.4.4
(gdb) bt
#0  0xf7f61340 in _linear_draw_sprite32 () from /usr/lib/../lib/liballeg.so.4.4
#1  0x0805584c in ?? ()

Play 3.

>character "head" is yet in room "blacktooth/blacktooth09.xml"
copy of character "head" with behavior "behavior of Head" is created to rebuild this room
[New Thread 0xd282fb40 (LWP 20315)]
creation of behavior "behavior of disappearance in time" for free item "bubbles" at x=80 y=15 z=48 with orientation "nowhere"
creation of behavior "behavior of disappearance in time" for free item "bubbles" at x=80 y=63 z=48 with orientation "nowhere"
creation of behavior "behavior of disappearance in time" for free item "bubbles" at x=130 y=61 z=72 with orientation "nowhere"
creation of behavior "behavior of disappearance in time" for free item "bubbles" at x=80 y=63 z=24 with orientation "nowhere"
>
>Thread 34 "headoverheels" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xd282fb40 (LWP 20315)]
0xf7253fb0 in __memcpy_ssse3 () from /lib/libc.so.6
(gdb) bt
#0  0xf7253fb0 in __memcpy_ssse3 () from /lib/libc.so.6

I know about current problems with sequence of drawing, yet I re~factor some parts of code dealing with it

iso_overlap

As for segfaulting, may you build at 64e099a ( git checkout 64e099a && autoreconf -f -i && ..... ) ?

To look if that’s new mistake being introduced by latest two commits

It is not good.
64e099a

character "heels" is now in room "blacktooth/blacktooth23.xml"
copy of character "heels" with behavior "behavior of Heels" is created to rebuild this room
[New Thread 0xd282fb40 (LWP 14797)]
play new game
[New Thread 0xd3030b40 (LWP 14798)]
playing Ogg music/begin.ogg

Thread 2 "headoverheels" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xf6e40b40 (LWP 14790)]
0xf7f2d159 in _mix_some_samples () from /usr/lib/../lib/liballeg.so.4.4
(gdb) bt
#0 0xf7f2d159 in _mix_some_samples () from /usr/lib/../lib/liballeg.so.4.4
#1 0xf7a7eb4d in alsa_update () from /usr/lib/allegro/4.4.2/alleg-alsadigi.so
#2 0xf7f71102 in bg_man_pthreads_threadfunc ()
from /usr/lib/../lib/liballeg.so.4.4
#3 0xf736223a in start_thread () from /lib/libpthread.so.0
#4 0xf7212ee6 in clone () from /lib/libc.so.6
(gdb)

The af452f5 is still fine, without segmentations fault

6e4eaba

creation of behavior "behavior of disappearance in time" for free item "bubbles" at x=80 y=63 z=48 with orientation "nowhere"

Thread 27 "headoverheels" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xd282fb40 (LWP 27893)]
0xf7253fb0 in __memcpy_ssse3 () from /lib/libc.so.6

670db1e

character "head" is now in room "blacktooth/blacktooth06.xml"
copy of character "head" with behavior "behavior of Head" is created to rebuild this room
[New Thread 0xd282fb40 (LWP 16547)]
[New Thread 0xcfb3cb40 (LWP 16548)]
playing Ogg music/blacktooth.ogg
[Thread 0xcfb3cb40 (LWP 16548) exited]
toggled switch in room blacktooth/blacktooth06.xml

Thread 1 "headoverheels" received signal SIGSEGV, Segmentation fault.
0xf7f61340 in _linear_draw_sprite32 () from /usr/lib/../lib/liballeg.so.4.4
(gdb) bt
#0 0xf7f61340 in _linear_draw_sprite32 () from /usr/lib/../lib/liballeg.so.4.4

db9b7ac

player "head" is now in room "blacktooth/blacktooth09.xml"
copy of player "head" with behavior "behavior of Head" is created to rebuild this room
[New Thread 0xd282fb40 (LWP 29753)]
[New Thread 0xcdb38b40 (LWP 29754)]
playing Ogg music/blacktooth.ogg
[Thread 0xcdb38b40 (LWP 29754) exited]
creation of behavior "behavior of disappearance in time" for free item "bubbles" at x=80 y=15 z=48 with orientation "nowhere"
creation of behavior "behavior of disappearance in time" for free item "bubbles" at x=80 y=63 z=48 with orientation "nowhere"
creation of behavior "behavior of disappearance in time" for free item "bubbles" at x=130 y=61 z=72 with orientation "nowhere"
creation of behavior "behavior of disappearance in time" for free item "bubbles" at x=80 y=63 z=24 with orientation "nowhere"

Thread 1 "headoverheels" received signal SIGSEGV, Segmentation fault.
0xf7f61340 in _linear_draw_sprite32 () from /usr/lib/../lib/liballeg.so.4.4
(gdb) bt
#0 0xf7f61340 in _linear_draw_sprite32 () from /usr/lib/../lib/liballeg.so.4.4

The previous commit is fine. af452f5

That's what I could help...

OOhh nooo!
af452f5

[Thread 0xc55a6b40 (LWP 12328) exited]
creation of behavior "behavior of disappearance in time" for free item "bubbles" at x=16 y=79 z=0 with orientation "nowhere"
creation of behavior "behavior of disappearance in time" for free item "bubbles" at x=2 y=77 z=72 with orientation "nowhere"
[Thread 0xd282fb40 (LWP 12327) exited]
here’s existing screen for action " CreateListOfSavedGames "
parse "/home/attila/.headoverheels/savegame/save1.xml"
parse "/home/attila/.headoverheels/savegame/save2.xml"
parse "/home/attila/.headoverheels/savegame/save3.xml"
save "/home/attila/.headoverheels/savegame/save4.xml" is yet free
save "/home/attila/.headoverheels/savegame/save5.xml" is yet free
save "/home/attila/.headoverheels/savegame/save6.xml" is yet free
save "/home/attila/.headoverheels/savegame/save7.xml" is yet free
save "/home/attila/.headoverheels/savegame/save8.xml" is yet free
save "/home/attila/.headoverheels/savegame/save9.xml" is yet free
save "/home/attila/.headoverheels/savegame/save10.xml" is yet free
~~ done with action ContinueGame

Thread 1 "headoverheels" received signal SIGSEGV, Segmentation fault.
0x080a1cba in ?? ()
(gdb) bt

I moved my dealing with new ways of drawing ‘n’ sorting into another branch

May you build current master with ./configure --enable-debug and test it ?

Bad.

  1. New game.

playing Ogg music/begin.ogg

Thread 2 "headoverheels" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xf6e40b40 (LWP 11933)]
0xf7f2d159 in _mix_some_samples () from /usr/lib/../lib/liballeg.so.4.4

  1. restart in gdb, and load old game.

Thread 9 "headoverheels" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xd23e1b40 (LWP 11955)]
0xf7253fb0 in __memcpy_ssse3 () from /lib/libc.so.6

got it, that’s problem inside allegro4 library, somewhy it doesn’t want to play begin.ogg at first time

when you load some old game and exit it, then new one would be okay

but this surely is a big bug, and I don’t yet know how to work around it

and I can’t reproduce that in __memcpy_ssse3 () from /lib/libc.so.6 here on my platform, maybe some more lines of backtracing, down to headoverheels’ code?

No, and no.
The allegro4 library is the same, not changed.
In the coding of the game something has now been changed that causes that.

Thread 1 "headoverheels" received signal SIGSEGV, Segmentation fault.
0xf7f61340 in _linear_draw_sprite32 () from /usr/lib/../lib/liballeg.so.4.4
(gdb) bt

well, may you do git bisect ?

find commit when game was okay on your side, then git bisect start, git bisect bad, git bisect good %sha of that working commit%

I have with git the repos, with various commits download, packaged from it, installed and tried.
I made the stable packet for UHU-Linux from git: //github.com/dougmencken/HeadOverHeels.git@d9ed8ab. That works well.
Now I have tried to make a newer, but I did not succeed. I started with the master, and then I tried all the ones I mentioned above.

I have on my side

play new game
playing Ogg music/begin.ogg

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
[Switching to process 76266 thread 0xfa03]
0x00394060 in mix_hq2_16x2_samples ()
(gdb) bt
#0  0x00394060 in mix_hq2_16x2_samples ()
#1  0x00395834 in _mix_some_samples ()
#2  0x003dcb84 in render_callback ()
#3  0x26e3a7c8 in dyld_stub_strlen ()
#4  0x26e39da8 in dyld_stub_strlen ()
#5  0x26e38f64 in dyld_stub_strlen ()
#6  0x97455c10 in AudioConverterChain::CallInputProc ()
#7  0x974557d4 in AudioConverterChain::FillBufferFromInputProc ()
#8  0x97455718 in BufferedAudioConverter::GetInputBytes ()
#9  0x9745556c in CBRConverter::RenderOutput ()
#10 0x974552f4 in BufferedAudioConverter::FillBuffer ()
#11 0x97455464 in AudioConverterChain::RenderOutput ()
#12 0x974552f4 in BufferedAudioConverter::FillBuffer ()
#13 0x9746ad48 in AudioConverterFillComplexBuffer ()
#14 0x26e38ad0 in dyld_stub_strlen ()
#15 0x26e31d04 in dyld_stub_strlen ()
#16 0x26e66478 in SystemOutputAUEntry ()
#17 0x26e3a74c in dyld_stub_strlen ()
#18 0x26e39da8 in dyld_stub_strlen ()
#19 0x26e38f64 in dyld_stub_strlen ()
#20 0x97455c10 in AudioConverterChain::CallInputProc ()
#21 0x974557d4 in AudioConverterChain::FillBufferFromInputProc ()
#22 0x97455718 in BufferedAudioConverter::GetInputBytes ()
#23 0x974a8b88 in BlockCopyConverter::RenderOutput ()
#24 0x974552f4 in BufferedAudioConverter::FillBuffer ()
#25 0x97455464 in AudioConverterChain::RenderOutput ()
#26 0x974552f4 in BufferedAudioConverter::FillBuffer ()
#27 0x9746ad48 in AudioConverterFillComplexBuffer ()
#28 0x26e38ad0 in dyld_stub_strlen ()
#29 0x26e31d04 in dyld_stub_strlen ()
#30 0x26e3d40c in AUGenericOutputEntry ()
#31 0x97d0e624 in HP_IOProc::Call ()
#32 0x97d0e2b0 in IOA_Device::CallIOProcs ()
#33 0x97d0e164 in HP_IOThread::PerformIO ()
#34 0x97d0cb34 in HP_IOThread::WorkLoop ()
#35 0x97d0c7f4 in HP_IOThread::ThreadEntry ()
#36 0x97cfade8 in CAPThread::Entry ()
#37 0x933f3f74 in _pthread_start ()
(gdb)

Tomorrow.

by teh way, removing that file rm ./game/share/headoverheels/music/begin.ogg helps

maybe it’s too... too somewhat for allegro library to play it

Emptying the sounds and music folders will not help, the segmentation error exists.

I tried again and af452f5 seems good.
I opened the other issue with this.

Not good. Mégis rossz!

Segfault again.

03.20 a9d79bc bad
(new game)

character "head" is now in room "blacktooth/blacktooth09.xml"
copy of character "head" with behavior "behavior of Head" is created to rebuild this room
[New Thread 0xd282fb40 (LWP 30773)]
[New Thread 0xcdb38b40 (LWP 30774)]
playing Ogg music/blacktooth.ogg
[Thread 0xcdb38b40 (LWP 30774) exited]
creation of behavior "behavior of disappearance in time" for free item "bubbles" at x=80 y=15 z=48 with orientation "nowhere"

Thread 27 "headoverheels" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xd282fb40 (LWP 30773)]
0xf7255e0e in __memcpy_ssse3 () from /lib/libc.so.6

03.18 64e099a bad
03.12 6e4eaba bad
03.11 4fa536d ??
03.11 62a9013 ??
03.11 e5f4c92 ??
03.11 670db1e bad

03.08 db9b7ac bad
(new game)
entry coordinates are x=1 y=69 z=48
player "head" is now in room "blacktooth/blacktooth09.xml"
copy of player "head" with behavior "behavior of Head" is created to rebuild this room
[New Thread 0xd282fb40 (LWP 11855)]
[New Thread 0xce339b40 (LWP 11856)]
playing Ogg music/blacktooth.ogg

Thread 1 "headoverheels" received signal SIGSEGV, Segmentation fault.
0xf7f61340 in _linear_draw_sprite32 () from /usr/lib/../lib/liballeg.so.4.4

(empty sound and music folders, new game)

player "head" is now in room "blacktooth/blacktooth06.xml"
copy of player "head" with behavior "behavior of Head" is created to rebuild this room
[New Thread 0xd30e3b40 (LWP 11961)]
can’t play Ogg music/blacktooth.ogg

Thread 1 "headoverheels" received signal SIGSEGV, Segmentation fault.
0xf7f61340 in _linear_draw_sprite32 () from /usr/lib/../lib/liballeg.so.4.

03.07 af452f5 bad (in savegame)

creation of behavior "behavior of disappearance in time" for free item "bubbles" at x=2 y=13 z=24 with orientation "nowhere"
[Thread 0xd282fb40 (LWP 25446) exited]
here’s existing screen for action " CreateListOfSavedGames "
Screen::loadAnimation( "head.gif" ) got 18 frames
Screen::loadAnimation( "heels.gif" ) got 16 frames
parse "/home/attila/.headoverheels/savegame/save1.xml"
parse "/home/attila/.headoverheels/savegame/save2.xml"
parse "/home/attila/.headoverheels/savegame/save3.xml"
parse "/home/attila/.headoverheels/savegame/save4.xml"
parse "/home/attila/.headoverheels/savegame/save5.xml"
parse "/home/attila/.headoverheels/savegame/save6.xml"
save "/home/attila/.headoverheels/savegame/save7.xml" is yet free
save "/home/attila/.headoverheels/savegame/save8.xml" is yet free
save "/home/attila/.headoverheels/savegame/save9.xml" is yet free
save "/home/attila/.headoverheels/savegame/save10.xml" is yet free
~~ done with action ContinueGame

Thread 1 "headoverheels" received signal SIGSEGV, Segmentation fault.
0x080a214a in ?? ()

67e90ae
Looks good.

crash in _linear_draw_sprite32 is randomly reproducible

Thread 1 Crashed:
0   liballeg.4.4.dylib            	0x01cf2c50 _linear_draw_sprite32 + 480
1   headoverheels                 	0x0000c554 draw_sprite + 128 (parsing.txx:337)
2   headoverheels                 	0x0000c554 draw_sprite + 128 (parsing.txx:337)
3   headoverheels                 	0x0000caec isomot::FloorTile::draw(BITMAP*) + 84 (stl_tree.h:660)
4   headoverheels                 	0x000756d0 isomot::Room::draw(BITMAP*) + 508
5   headoverheels                 	0x00055540 isomot::Room::drawRoom() + 60
6   headoverheels                 	0x00051be4 isomot::Isomot::update() + 5128

It looks like game draws already finalized shady image of tile. May you build “ introduce wrappers for functions of allegro library ”? 7261f38

( allegro::drawSprite ) raw image of floor tile at cx=2 cy=3
( allegro::drawSprite ) shady image of floor tile at cx=2 cy=4
( allegro::drawSprite ) shady image of floor tile at cx=2 cy=5

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x430a0000
[Switching to process 57965 thread 0x3803]
0x0000d094 in draw_sprite (bmp=0x2990ec00, sprite=0x2793b3e0, x=225, y=288) at inline/draw.inl:238
238	AL_INLINE(void, draw_sprite, (BITMAP *bmp, BITMAP *sprite, int x, int y),
(gdb) bt
#0  0x0000d094 in draw_sprite (bmp=0x2990ec00, sprite=0x2793b3e0, x=225, y=288) at inline/draw.inl:238
#1  0x0000e2ec in allegro::drawSprite (view=0x2990ec00, sprite=0x2793b3e0, x=225, y=288, printMe=@0xf007ffa4) at WrappersAllegro.hpp:32
#2  0x0000dcac in isomot::FloorTile::draw (this=0x2795cf20, where=0x2990ec00) at FloorTile.cpp:45
#3  0x00078b78 in isomot::Room::draw (this=0x27928770, where=0x2990ec00) at Room.cpp:783
#4  0x00057a34 in isomot::Room::drawRoom (this=0x27928770) at Room.hpp:90
#5  0x000550e8 in isomot::Isomot::update (this=0x27936200) at Isomot.cpp:372

As I see running updated 27e9822 , game draws previously destroyed image, and then destroys it again

( allegro::drawSprite ) raw image of floor tile at cx=1 cy=3 via FloorTile::draw
( allegro::drawSprite ) raw image of floor tile at cx=1 cy=4 via FloorTile::draw
( allegro::drawSprite ) raw image of floor tile at cx=1 cy=5 via FloorTile::draw
( allegro::destroyBitmap ) shady image of floor tile at cx=1 cy=6 via FloorTile::setShadyImage
( allegro::drawSprite ) shady image of floor tile at cx=1 cy=6 via FloorTile::draw
( allegro::destroyBitmap ) shady image of floor tile at cx=1 cy=6 via FloorTile::setShadyImage
( allegro::drawSprite ) raw image of floor tile at cx=2 cy=3 via FloorTile::draw
( allegro::drawSprite ) raw image of floor tile at cx=2 cy=4 via FloorTile::draw
( allegro::destroyBitmap ) shady image of floor tile at cx=2 cy=5 via FloorTile::setShadyImage
( allegro::drawSprite ) shady image of floor tile at cx=2 cy=5 via FloorTile::draw
( allegro::destroyBitmap ) shady image of floor tile at cx=2 cy=6 via FloorTile::setShadyImage
( allegro::drawSprite ) shady image of floor tile at cx=2 cy=6 via FloorTile::draw
( allegro::destroyBitmap ) shady image of floor tile at cx=2 cy=5 via FloorTile::setShadyImage
( allegro::destroyBitmap ) shady image of floor tile at cx=2 cy=6 via FloorTile::setShadyImage

7261f38

( allegro::drawSprite ) shady image of floor tile at cx=3 cy=5
( allegro::drawSprite ) raw image of floor tile at cx=4 cy=0
( allegro::drawSprite ) raw image of floor tile at cx=4 cy=1
( allegro::drawSprite ) raw image of floor tile at cx=4 cy=2
( allegro::drawSprite ) raw image of floor tile at cx=4 cy=3
( allegro::drawSprite ) shady image of floor tile at cx=4 cy=4

Thread 1 "headoverheels" received signal SIGSEGV, Segmentation fault.
0x00007ffff7b6ae50 in _linear_draw_sprite32 () from /usr/lib/liballeg.so.4.4
(gdb) bt
#0 0x00007ffff7b6ae50 in _linear_draw_sprite32 ()
from /usr/lib/liballeg.so.4.4

27e9822

( allegro::drawSprite ) raw image of floor tile at cx=6 cy=1 via FloorTile::draw
( allegro::drawSprite ) raw image of floor tile at cx=6 cy=2 via FloorTile::draw
( allegro::destroyBitmap ) shady image of floor tile at cx=6 cy=3 via FloorTile::setShadyImage
( allegro::drawSprite ) shady image of floor tile at cx=6 cy=3 via FloorTile::draw
( allegro::destroyBitmap ) shady image of floor tile at cx=6 cy=3 via FloorTile::setShadyImage

Thread 1 "headoverheels" received signal SIGSEGV, Segmentation fault.
0x00007ffff7b6ae50 in _linear_draw_sprite32 () from /usr/lib/liballeg.so.4.4

does it crash yet on draw_sprite with updated wrappers 5b825a2 or not?

--- a/src/WrappersAllegro.hpp
+++ b/src/WrappersAllegro.hpp
@@ -28,7 +28,10 @@
  */
 inline void drawSprite( BITMAP* view, BITMAP* sprite, int x, int y, const std::string& printMe = "" )
 {
+        if ( sprite == NULL ) return ;
+
         if ( ! printMe.empty() ) std::cout << "( allegro::drawSprite ) " << printMe << std::endl ;
+
         draw_sprite( view, sprite, x, y );
 }

@@ -38,8 +41,12 @@
  */
 inline void destroyBitmap( BITMAP*& bitmap, const std::string& printMe = "" )
 {
+        if ( bitmap == NULL ) return ;
+
         if ( ! printMe.empty() ) std::cout << "( allegro::destroyBitmap ) " << printMe << std::endl ;
+
         destroy_bitmap( bitmap );
+        bitmap = NULL ;
 }

 }

uhmmm

( allegro::drawSprite ) raw image of floor tile at cx=2 cy=2 via FloorTile::draw
( allegro::drawSprite ) raw image of floor tile at cx=2 cy=3 via FloorTile::draw
( allegro::drawSprite ) raw image of floor tile at cx=2 cy=4 via FloorTile::draw
( allegro::drawSprite ) shady image of floor tile at cx=2 cy=5 via FloorTile::draw
( allegro::destroyBitmap ) shady image of floor tile at cx=2 cy=5 via FloorTile::setShadyImage
Bus error

Thread 1 Crashed:
0   headoverheels   0x0000d3d0 draw_sprite + 44
1   headoverheels   0x0000e350 allegro::drawSprite(BITMAP*, BITMAP*, int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) + 156
2   headoverheels   0x0000de18 isomot::FloorTile::draw(BITMAP*) + 160
3   headoverheels   0x00078868 isomot::Room::draw(BITMAP*) + 508
4   headoverheels   0x00058390 isomot::Room::drawRoom() + 60
5   headoverheels   0x000549e8 isomot::Isomot::update() + 5128

5b825a2

( allegro::drawSprite ) raw image of floor tile at cx=2 cy=3 via FloorTile::draw
( allegro::drawSprite ) shady image of floor tile at cx=2 cy=4 via FloorTile::draw
( allegro::destroyBitmap ) shady image of floor tile at cx=2 cy=4 via FloorTile::setShadyImage
( allegro::destroyBitmap ) shady image of floor tile at cx=2 cy=5 via FloorTile::setShadyImage
( allegro::destroyBitmap ) shady image of floor tile at cx=3 cy=4 via FloorTile::setShadyImage
( allegro::destroyBitmap ) shady image of floor tile at cx=3 cy=5 via FloorTile::setShadyImage

Thread 1 "headoverheels" received signal SIGSEGV, Segmentation fault.
0xf7f61340 in _linear_draw_sprite32 () from /usr/lib/../lib/liballeg.so.4.4
(gdb) bt
#0 0xf7f61340 in _linear_draw_sprite32 () from /usr/lib/../lib/liballeg.so.4.4

With this patch there is no segmentation error. I've played it until penetrary.
These commit is patched: af452f5
good.diff.zip

Brrrrr....
With the patch this:
5b825a2
is not good, again segmentation fault.
In fact, this is not good either: db9b7ac

Aberration... What I thought good was not good.
Again is segmentation fault with patched af452f5

parse "/home/attila/.headoverheels/savegame/save7.xml"
save "/home/attila/.headoverheels/savegame/save8.xml" is yet free
save "/home/attila/.headoverheels/savegame/save9.xml" is yet free
save "/home/attila/.headoverheels/savegame/save10.xml" is yet free
~~ done with action ContinueGame

Thread 1 "headoverheels" received signal SIGSEGV, Segmentation fault.
0x080a20ca in ?? ()

I can’t repeat segfault on load ( on save? ) of game on my side. And 0x080a20ca in ?? () says nothing to me, I need names of functions, and some deeper lines of backtrace too

I do not know how to make such a more accurate debuginfo, but I really need to do that. Yours are much deeper than mine. I'm just desperate.

Configure with --enable-debug, make, and then gdb’s bt would print the whole stack of call chain. And what are you doing before that crash? Eating fish to save game? Using “escape” key on screen with saved games? Looks like the latter, but on my side it’s okay

here’s existing screen for action " CreateListOfSavedGames "
Screen::loadAnimation( "head.gif" ) got 18 frames
Screen::loadAnimation( "heels.gif" ) got 16 frames
parse "/Users/me/.headoverheels/savegame/save1.xml"
parse "/Users/me/.headoverheels/savegame/save2.xml"
parse "/Users/me/.headoverheels/savegame/save3.xml"
parse "/Users/me/.headoverheels/savegame/save4.xml"
parse "/Users/me/.headoverheels/savegame/save5.xml"
parse "/Users/me/.headoverheels/savegame/save6.xml"
parse "/Users/me/.headoverheels/savegame/save7.xml"
parse "/Users/me/.headoverheels/savegame/save8.xml"
parse "/Users/me/.headoverheels/savegame/save9.xml"
parse "/Users/me/.headoverheels/savegame/save10.xml"
escape action ContinueGame ~~
GameManager::resume ()
( allegro::drawSprite ) raw image of floor tile at cx=0 cy=1 via FloorTile::draw
( allegro::drawSprite ) raw image of floor tile at cx=0 cy=2 via FloorTile::draw

As for crash on drawing+destroying images of floor tiles, take this patch

--- a/src/Mediator.cpp
+++ b/src/Mediator.cpp
@@ -291,7 +291,7 @@ void Mediator::reshadeWithGridItem( GridItem* item )
         // shade floor in this column, if any
         if ( room->floor[ column ] != nilPointer )
         {
-                room->floor[ column ]->binShadyImage();
+////////                room->floor[ column ]->binShadyImage();
                 room->floor[ column ]->setWantShadow( true );
         }
 }
@@ -328,7 +328,7 @@ void Mediator::reshadeWithFreeItem( FreeItem* item )
                         // shade floor in this column, if any
                         if ( room->floor[ column ] != nilPointer )
                         {
-                                room->floor[ column ]->binShadyImage();
+////////                                room->floor[ column ]->binShadyImage();
                                 room->floor[ column ]->setWantShadow( true );
                         }
                 }

I updated master too b2fc6b1

But this introduced some lack of update of tiles’ shadows, see #29

tints after disappear

I tried the master.
The --enable-debug option has already written the alsa error.
There was a segmentation error with the master in a new game.

( allegro::drawSprite ) raw image of floor tile at cx=6 cy=7 via FloorTile::draw

Thread 2 "headoverheels" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xf6e40b40 (LWP 27764)]
0xf7f2d159 in _mix_some_samples () from /usr/lib/../lib/liballeg.so.4.4
(gdb) bt
#0 0xf7f2d159 in _mix_some_samples () from /usr/lib/../lib/liballeg.so.4.4
#1 0xf7a7eb4d in alsa_update () from /usr/lib/allegro/4.4.2/alleg-alsadigi.so
#2 0xf7f71102 in bg_man_pthreads_threadfunc () from /usr/lib/../lib/liballeg.so.4.4
#3 0xf736223a in start_thread () from /lib/libpthread.so.0
#4 0xf7212ee6 in clone () from /lib/libc.so.6
(gdb)

And surprise!
After renaming the Sounds folder, it was good and then renamed the folder to the old one, with a newer game there was nothing wrong with the sound and the game.

And besides fail on playing music ( let’s deal with it later )? There’s no magic button or magic line which would fix any and all of segfaults at once. Is floor tile drawing crash fixed on your side? How’s bout error after ~~ done with action ContinueGame?

I have no idea. Sometimes it is good, sometimes not.
But the whole thing is not stable, I can not reconstruct the errors every time.
I let the whole thing rest a little bit.

Sometimes it is good, sometimes not.
But the whole thing is not stable, I can not reconstruct the errors every time.

Yeah, that’s what I name “randomly reproducible”

yet I hope that freshShadyImage solved all problems with drawing tiles of floor

Recently the segmentation faults have also disappeared.

I’m going to improve wrapper

--- a/src/WrappersAllegro.hpp
+++ b/src/WrappersAllegro.hpp
@@ -48,8 +48,13 @@ inline void destroyBitmap( BITMAP*& bitmap /*~ , const std::string& printMe = ""

         /*~ if ( ! printMe.empty() ) std::cout << "( allegro::destroyBitmap ) " << printMe << std::endl; ~*/

-        destroy_bitmap( bitmap );
+        // nullify it first, then invoke destroy_bitmap
+        // to avoid drawing of being-destroyed thing when there’re many threads
+
+        BITMAP* toBin = bitmap;
         bitmap = NULL ;
+
+        destroy_bitmap( toBin );
 }

 }

And again...

exit coordinates are x=41 y=11 z=0
entry coordinates are x=57 y=159 z=24
character "headoverheels" is yet in room "safari/safari02.xml"
copy of character "headoverheels" with behavior "behavior of Head over Heels" is created to rebuild this room
[New Thread 0xd1278b40 (LWP 1685)]

Thread 2 "headoverheels" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xf6e40b40 (LWP 1573)]
0xf7f2dde5 in _mix_some_samples () from /usr/lib/../lib/liballeg.so.4.4
(gdb) bt
#0 0xf7f2dde5 in _mix_some_samples () from /usr/lib/../lib/liballeg.so.4.4
#1 0xf7a7eb4d in alsa_update () from /usr/lib/allegro/4.4.2/alleg-alsadigi.so
#2 0xf7f71102 in bg_man_pthreads_threadfunc () from /usr/lib/../lib/liballeg.so.4.4
#3 0xf736223a in start_thread () from /lib/libpthread.so.0
#4 0xf7212ee6 in clone () from /lib/libc.so.6
(gdb)
safari

I haven’t yet another solution for crash with ogg playing on begin new game than

--- a/src/Isomot.cpp
+++ b/src/Isomot.cpp
@@ -55,7 +55,7 @@ void Isomot::beginNewGame ()
         mapManager->getActiveRoom()->activate ();

         std::cout << "play new game" << std::endl ;
-        SoundManager::getInstance()->playOgg ( "music/begin.ogg", /* loop */ false );
+        ///////SoundManager::getInstance()->playOgg ( "music/begin.ogg", /* loop */ false );
 }

 void Isomot::continueSavedGame ( const sgxml::players::player_sequence& playerSequence )

patched 4637ddc
new game:

character "head" is yet active in room "blacktooth/blacktooth20.xml"
copy of character "head" with behavior "behavior of Head" is created to rebuild this room
[New Thread 0xd282fb40 (LWP 14725)]
[New Thread 0xc7dabb40 (LWP 14726)]
playing Ogg music/blacktooth.ogg
[Thread 0xc7dabb40 (LWP 14726) exited]

Thread 1 "headoverheels" received signal SIGSEGV, Segmentation fault.
0xf7f61340 in _linear_draw_sprite32 () from /usr/lib/../lib/liballeg.so.4.4
(gdb) bt
#0 0xf7f61340 in _linear_draw_sprite32 () from /usr/lib/../lib/liballeg.so.4.4
#1 0x08056f3c in ?? ()

old, loaded game:

character "heels" is yet active in room "blacktooth/blacktooth60.xml"
[New Thread 0xd23e1b40 (LWP 14883)]
[New Thread 0xd0a77b40 (LWP 14884)]
playing Ogg music/blacktooth.ogg

Thread 16 "headoverheels" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xd23e1b40 (LWP 14883)]
0x0809f198 in ?? ()

As for playing Oggs... This one

[New Thread 0xc7dabb40 (LWP 14726)]
playing Ogg music/blacktooth.ogg
[Thread 0xc7dabb40 (LWP 14726) exited]

is okay, player’s thread was created and exited

But this

[New Thread 0xd0a77b40 (LWP 14884)]
playing Ogg music/blacktooth.ogg

Thread 16 "headoverheels" received signal SIGSEGV

means it cannot finish by whatever reason. Interesting is that previous one #25 (comment) didn’t print “ playing Ogg ”, so it may be something wrong between oggThread = alogg_create_thread( this->oggStream ); and std::cout << " Ogg " << fileName << std::endl ; inside src/SoundManager.cpp

As for another crash on draw_sprite... Maybe dealing just with floor tiles ignoring other elements weren’t enough... Can’t repeat it on my side yet

@attuska may you reproduce these fails with current master?

I needed to compile a new package: tinyxml2. (https://github.com/leethomason/tinyxml2/archive/6.0.0.tar.gz)
I can not do anything, the game is unobtrusively fast.

Yeah, I’m replacing monstrous xerces-c with little tinyxml2

What do you mean as “unobtrusively fast”? Like that timers don’t work? That’s probably due to parsing of floating-point values like speed="0.030", which is in seconds, via atof. And this may rise a problem with decimal separators, I dunno which is used in magyar’s locale, maybe not “.” but “,” or whatever. I think about converting that to milliseconds, as example speed="30"

Plus I renamed files of game’s rooms, so previous saves don’t work anymore

Yep, it is the problem

atof and strtod are locale dependant

on systems where locale defines comma as decimal separator, atof function ignores period and whole fraction part

Patch

--- a/src/ItemDataManager.cpp
+++ b/src/ItemDataManager.cpp
@@ -62,15 +62,24 @@ void ItemDataManager::loadItems ()

                 // how long, in milliseconds, it falls
                 tinyxml2::XMLElement* weight = item->FirstChildElement( "weight" ) ;
-                newItem->weight = std::atof( weight->FirstChild()->ToText()->Value() ) ;
+                if ( weight != nilPointer )
+                        newItem->weight = static_cast< double >( std::atoi( weight->FirstChild()->ToText()->Value() ) ) / 1000.0 ;
+                else
+                        newItem->weight = 0.0 ;

                 // delay, in milliseconds, between frames in animation sequence
                 tinyxml2::XMLElement* framesDelay = item->FirstChildElement( "framesDelay" ) ;
-                newItem->delayBetweenFrames = std::atof( framesDelay->FirstChild()->ToText()->Value() ) ;
+                if ( framesDelay != nilPointer )
+                        newItem->delayBetweenFrames = static_cast< double >( std::atoi( framesDelay->FirstChild()->ToText()->Value() ) ) / 1000.0 ;
+                else
+                        newItem->delayBetweenFrames = 0.0 ;

                 // how many milliseconds this item moves one single isometric unit
                 tinyxml2::XMLElement* speed = item->FirstChildElement( "speed" ) ;
-                newItem->speed = std::atof( speed->FirstChild()->ToText()->Value() ) ;
+                if ( speed != nilPointer )
+                        newItem->speed = static_cast< double >( std::atoi( speed->FirstChild()->ToText()->Value() ) ) / 1000.0 ;
+                else
+                        newItem->speed = 0.0 ;

                 {
                         tinyxml2::XMLElement* picture = item->FirstChildElement( "picture" ) ;

@attuska please test updated master

In Hungary the decimal separator is the comma and not the point.
LC_NUMERIC="hu_HU.UTF-8"

I converted them all from floating-point seconds like 0.020 to integer milliseconds like just 20

The speed is good, but once the segfault in the allegro libs has occurred anyway, but only once.

creation of behavior "behavior of disappearance in time" for free item "bubbles" at x=80 y=63 z=24 with orientation "nowhere"
free item "bubbles 1st" is yet in room "penitentiary13.xml"
removing grid item "brick1 8th @80,63,24" from room "penitentiary13.xml"

Thread 1 "headoverheels" received signal SIGSEGV, Segmentation fault.
0xf7f61340 in _linear_draw_sprite32 () from /usr/lib/../lib/liballeg.so.4.4

I have now compiled the game for 64 bit platform and tried it out, so far I have had no segmentation faults (penitentrary after the safari).

I finished migration from “too serious and hard” xerces-c to tinyxml2 ( yeah, you don’t need xerces-c for headoverheels anymore :)

During that, I found flaw

-std::vector< std::string > GameManager::getToolsOwnedByPlayer ( const std::string& player ) const
+void GameManager::toolsOwnedByCharacter ( const std::string& player, std::vector< std::string >& tools ) const

previous getToolsOwnedByPlayer returned temporary stuff from stack of that function, this change possibly fixes some segfaults

And again I changed description of saved games, sorry for that

Hmmm. Without xerces-c headers after autoreconf -vif:

checking for ogg/ogg.h... yes
checking xercesc/util/XercesVersion.hpp usability... no
checking xercesc/util/XercesVersion.hpp presence... no
checking for xercesc/util/XercesVersion.hpp... no
configure: error: xerces-c headers not found

Uhm, are you sure that you got fresh master? Does your configure.ac look the same as https://github.com/dougmencken/HeadOverHeels/blob/master/configure.ac ?

Sorry, the master is fine!
The segmentation faults are gone, you can close the issue.

Nice, but I want to leave this issue open

This “ parts of walls don’t need to be grid items ” 5c89b76 introduced some change in sequence of drawing, walls are drawn first, and then grid and free items like parts of door. This made doors ~ north and east ones, which collide with walls ~ to cut off parts of adjacent wall, like on your second picture

doors and walls

Plus that same change did side effect that character is shown thru door

in door

thru door

And aditionally. In egyptus, heels can not continue to converge, can not jump up from left immediately in the direction of left on the platform. Or should I just be able to do that? In the original game (speccy) that was hard, but not impossible.

going to create room "egyptus15.xml"
building room via data from /usr/share/headoverheels/map/egyptus15.xml
free item "egyptus-door-westleftjamb 1st" is yet in room "egyptus15.xml"
free item "egyptus-door-west
rightjamb 1st" is yet in room "egyptus15.xml"
free item "egyptus-door-west~lintel 1st" is yet in room "egyptus15.xml"
grid item "brick2 1st @0,15,0" is yet part of room "egyptus15.xml"
grid item "brick2 2nd @32,15,24" is yet part of room "egyptus15.xml"
creation of behavior "behavior of slow disappearance on jump into" for grid item "brick2" at x=32 y=15 z=96 with orientation "nowhere"
grid item "brick2 3rd @32,15,96" is yet part of room "egyptus15.xml"
grid item "brick2 4th @48,15,72" is yet part of room "egyptus15.xml"
grid item "brick2 5th @64,15,24" is yet part of room "egyptus15.xml"
grid item "brick2 6th @64,15,120" is yet part of room "egyptus15.xml"
grid item "spikes 1st @80,15,0" is yet part of room "egyptus15.xml"
creation of behavior "behavior of slow disappearance on jump into" for grid item "brick2" at x=80 y=15 z=48 with orientation "nowhere"
grid item "brick2 7th @80,15,48" is yet part of room "egyptus15.xml"
grid item "brick2 8th @80,15,144" is yet part of room "egyptus15.xml"
creation of behavior "behavior of big leap for player" for free item "trampoline" at x=82 y=13 z=168 with orientation "nowhere"
free item "trampoline 1st" is yet in room "egyptus15.xml"
exit coordinates are x=73 y=11 z=120
entry coordinates are x=41 y=111 z=0
adding character "heels" to room "egyptus15.xml"
character "heels" is yet active in room "egyptus15.xml"
copy of character "heels" with behavior "behavior of Heels" is created to rebuild this room
[New Thread 0x7fffdd1a0700 (LWP 1716)]
grid item "brick2 8th @80,15,144" at x=80 y=15 z=144 is set as anchor for free item "trampoline 1st" at x=82 y=13 z=168
grid item "brick2 1st @0,15,0" at x=0 y=15 z=0 is set as anchor for player item "character heels @ egyptus15.xml" at x=6 y=12 z=24
grid item "brick2 2nd @32,15,24" at x=32 y=15 z=24 is set as anchor for player item "character heels @ egyptus15.xml" at x=33 y=11 z=48
grid item "brick2 5th @64,15,24" at x=64 y=15 z=24 is set as anchor for player item "character heels @ egyptus15.xml" at x=67 y=11 z=48

egyptus15

I made new commit with

raise time of vanishing for items with “ behavior of slow disappearance on jump into ”
from 0.6 seconds to 0.8 seconds

And

new cheat to make items in room don’t disappear on jump into
keys are [ alt / option ] [ shift ] [ v ]

that egyptus15

Thanks, but that's possible without cheat, but that's certainly easier.
The cheat works...

Next thing I’m going to do is
convert segment of wall, adjacent ( next by x for north wall, next by y for east ) to north and / or east door, to grid item
by code ( either Room::addWall or Room::addDoor ), together with converting all walls of every room to walls in XML descriptions of rooms — beware of “ triple rooms ” here

Plus next cheat to make active character fly and don’t fall, [ alt / option ] + [ home ] to begin to fly, [ alt/option ] + [ end ] to end flying and feel gravity again (;

Then I’d refactor camera to make it much more smart and nice to help to solve #12 and #26

A tip:

The deauflt 640x480 window is too small, the minimum should be 800x600, even better 1024x769. In 16/9 monitors in fullsrceen everything is flat, since the original game is adapted to 3/4 monitors (TV). It would be useful to make the output screen adjustable.

I thought to delay support of various sizes of screen and dynamic rotation to porting to smartphones, but... But why not yet, for big desktops too? I created problem #30 to chat about that

first

“ zero gravity ” cheat is done, that’s how it looks like

head and zero gravity

Done
✔ convert each wall of every room to walls in XML descriptions of rooms
✔ convert segment of wall, adjacent ( next by Y for north wall, next by X for east ) to north or east door, to grid item

I close this yet