Bug#944431: Segfault on startup

Bernhard Übelacker bernhardu at mailbox.org
Mon Nov 18 17:03:02 GMT 2019


Hello Markus, hello Enrico,
I am sorry to be late, but I guess I have found the issue.
The function SetThreadPriority does not return properly
therefore the following function gets executed which writes
to somewhere, that causes later the crash below.

The build logs show a warning for this issue:

    tmp/compat_mini.cpp: In function ‘int SetThreadPriority(THREAD_HANDLE, int)’:
    tmp/compat_mini.cpp:106:1: warning: no return statement in function returning non-void [-Wreturn-type]
      106 | }
          | ^

Attached patch adds return statements for all functions
currently triggering this warning.

Kind regards,
Bernhard


(gdb) bt
#0  0x0000562c7679292e in flip () at komat/Berusky3d_ini.cpp:46
#1  0x0000562c767ea5e4 in ddxPublish () at tmp/compat.cpp:196
#2  0x0000562c767ea6a9 in DisplayFrame () at tmp/compat.cpp:120
#3  0x0000562c76737374 in RunMenu (p_File_Name=p_File_Name at entry=0x562c76888c8b "mainmenu.txt", hWnd=hWnd at entry=0x0, p_ad=<optimized out>, cpu=cpu at entry=8304) at kofola/Menu.cpp:5810
#4  0x0000562c767771b7 in winmain_Game_Run (p_Level_Name=0x562c76bf3148 <ber+1558248> "") at kofola/game_main.cpp:252
#5  0x0000562c7671b293 in main (argc=<optimized out>, argv=<optimized out>) at komat/Berusky3d_ini.cpp:360
-------------- next part --------------

# Buster/stable amd64 qemu VM 2019-11-15


apt update
apt dist-upgrade


apt install systemd-coredump dpkg-dev devscripts xserver-xorg lightdm openbox xterm gdb valgrind rr berusky2 berusky2-dbgsym
apt build-dep berusky2

reboot

echo 1 > /proc/sys/kernel/perf_event_paranoid


mkdir /home/benutzer/source/berusky2/orig -p
cd    /home/benutzer/source/berusky2/orig
apt source berusky2
cd



export DISPLAY=:0
export LANG=C


berusky2
# crashes

rr berusky2
# does not crash

valgrind berusky2
# crashes

valgrind --track-origins=yes berusky2
# crashes

gdb -q --args berusky2
# crashes

############


$ berusky2 
Berusky 2 v.0.10 (C) Anakreon 2011, http://www.anakreon.cz/
...
Kofola: - Load bitmap pro herni menu
--------------Total load time 0.2 s -----------------
APAK: font_en.pak
Velikost AFAT: 2.6KB
Velikost Archivu: 0.4MB
Souboru: 7
Adresaru: 0
Uzlu: 2
b2_2d_font.pTTable = 0x563f6ddc1160
set font = font_en.pak
APAK: font_system_en.pak
Velikost AFAT: 2.6KB
Velikost Archivu: 0.1MB
Souboru: 7
Adresaru: 0
Uzlu: 2
b2_2d_font.pTTable = 0x563f70bd40f0
set font = font_system_en.pak
Segmentation fault (core dumped)


#########


Nov 15 17:22:58 debian systemd-coredump[647]: Process 627 (berusky2) of user 1000 dumped core.
                                              
                                              Stack trace of thread 627:
                                              #0  0x0000563f6b62b92e n/a (berusky2)
                                              #1  0x0000563f6b6835e4 n/a (berusky2)
                                              #2  0x0000563f6b6836a9 n/a (berusky2)
                                              #3  0x0000563f6b5d0374 n/a (berusky2)
                                              #4  0x0000563f6b6101b7 n/a (berusky2)
                                              #5  0x0000563f6b5b4293 main (berusky2)
                                              #6  0x00007f2f6423a09b __libc_start_main (libc.so.6)
                                              #7  0x0000563f6b5b450a n/a (berusky2)
                                              
                                              Stack trace of thread 642:
                                              #0  0x00007f2f64304819 __poll (libc.so.6)
                                              #1  0x00007f2f63bdd9af n/a (libasound.so.2)
                                              #2  0x00007f2f63bddccb snd_pcm_wait (libasound.so.2)
                                              #3  0x00007f2f6498d2ff n/a (libopenal.so.1)
                                              #4  0x00007f2f6499bb67 n/a (libopenal.so.1)
                                              #5  0x00007f2f64701fa3 start_thread (libpthread.so.0)
                                              #6  0x00007f2f6430f4cf __clone (libc.so.6)
                                              
                                              Stack trace of thread 643:
                                              #0  0x00007f2f6470a896 do_futex_wait.constprop.1 (libpthread.so.0)
                                              #1  0x00007f2f6470a988 __new_sem_wait_slow.constprop.0 (libpthread.so.0)
                                              #2  0x00007f2f6499bff9 n/a (libopenal.so.1)
                                              #3  0x00007f2f649612dd n/a (libopenal.so.1)
                                              #4  0x00007f2f6499bb67 n/a (libopenal.so.1)
                                              #5  0x00007f2f64701fa3 start_thread (libpthread.so.0)
                                              #6  0x00007f2f6430f4cf __clone (libc.so.6)
                                              
                                              Stack trace of thread 644:
                                              #0  0x00007f2f6470bbf0 __nanosleep (libpthread.so.0)
                                              #1  0x00007f2f64ed3765 SDL_Delay (libSDL-1.2.so.0)
                                              #2  0x0000563f6b71602a n/a (berusky2)
                                              #3  0x00007f2f64701fa3 start_thread (libpthread.so.0)
                                              #4  0x00007f2f6430f4cf __clone (libc.so.6)
                                              
                                              Stack trace of thread 645:
                                              #0  0x00007f2f6470bbf0 __nanosleep (libpthread.so.0)
                                              #1  0x00007f2f64ed3765 SDL_Delay (libSDL-1.2.so.0)
                                              #2  0x0000563f6b7196b9 n/a (berusky2)
                                              #3  0x00007f2f64701fa3 start_thread (libpthread.so.0)
                                              #4  0x00007f2f6430f4cf __clone (libc.so.6)
Nov 15 17:22:58 debian systemd[1]: systemd-coredump at 0-646-0.service: Succeeded.


Nov 15 17:24:36 debian systemd-coredump[728]: Process 708 (berusky2) of user 1000 dumped core.
                                              
                                              Stack trace of thread 708:
                                              #0  0x0000562c7679292e _Z4flipv (berusky2)
                                              #1  0x0000562c767ea5e4 _Z10ddxPublishv (berusky2)
                                              #2  0x0000562c767ea6a9 _Z12DisplayFramev (berusky2)
                                              #3  0x0000562c76737374 _Z7RunMenuPcPvP10AUDIO_DATAi (berusky2)
                                              #4  0x0000562c767771b7 _Z16winmain_Game_RunPc (berusky2)
                                              #5  0x0000562c7671b293 main (berusky2)
                                              #6  0x00007f754517309b __libc_start_main (libc.so.6)
                                              #7  0x0000562c7671b50a _start (berusky2)
                                              
                                              Stack trace of thread 726:
                                              #0  0x00007f7545644bf0 __nanosleep (libpthread.so.0)
                                              #1  0x00007f7545e0c765 SDL_Delay (libSDL-1.2.so.0)
                                              #2  0x0000562c768806b9 ogg_proc (berusky2)
                                              #3  0x00007f754563afa3 start_thread (libpthread.so.0)
                                              #4  0x00007f75452484cf __clone (libc.so.6)
                                              
                                              Stack trace of thread 724:
                                              #0  0x00007f7545643896 do_futex_wait.constprop.1 (libpthread.so.0)
                                              #1  0x00007f7545643988 __new_sem_wait_slow.constprop.0 (libpthread.so.0)
                                              #2  0x00007f75458d4ff9 n/a (libopenal.so.1)
                                              #3  0x00007f754589a2dd n/a (libopenal.so.1)
                                              #4  0x00007f75458d4b67 n/a (libopenal.so.1)
                                              #5  0x00007f754563afa3 start_thread (libpthread.so.0)
                                              #6  0x00007f75452484cf __clone (libc.so.6)
                                              
                                              Stack trace of thread 725:
                                              #0  0x00007f7545644bf0 __nanosleep (libpthread.so.0)
                                              #1  0x00007f7545e0c765 SDL_Delay (libSDL-1.2.so.0)
                                              #2  0x0000562c7687d02a adas_ManagerProc (berusky2)
                                              #3  0x00007f754563afa3 start_thread (libpthread.so.0)
                                              #4  0x00007f75452484cf __clone (libc.so.6)
                                              
                                              Stack trace of thread 723:
                                              #0  0x00007f754523d819 __poll (libc.so.6)
                                              #1  0x00007f7544b169af n/a (libasound.so.2)
                                              #2  0x00007f7544b16ccb snd_pcm_wait (libasound.so.2)
                                              #3  0x00007f75458c62ff n/a (libopenal.so.1)
                                              #4  0x00007f75458d4b67 n/a (libopenal.so.1)
                                              #5  0x00007f754563afa3 start_thread (libpthread.so.0)
                                              #6  0x00007f75452484cf __clone (libc.so.6)
Nov 15 17:24:36 debian systemd[1]: systemd-coredump at 1-727-0.service: Succeeded.


##########


# coredumpctl gdb 708
...
Core was generated by `berusky2'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000562c7679292e in flip () at komat/Berusky3d_ini.cpp:46
46      komat/Berusky3d_ini.cpp: Datei oder Verzeichnis nicht gefunden.
[Current thread is 1 (Thread 0x7f7542a906c0 (LWP 708))]

set width 0
set pagination off
directory /home/benutzer/source/berusky2/orig/berusky2-0.10/src
bt

(gdb) bt
#0  0x0000562c7679292e in flip () at komat/Berusky3d_ini.cpp:46
#1  0x0000562c767ea5e4 in ddxPublish () at tmp/compat.cpp:196
#2  0x0000562c767ea6a9 in DisplayFrame () at tmp/compat.cpp:120
#3  0x0000562c76737374 in RunMenu (p_File_Name=p_File_Name at entry=0x562c76888c8b "mainmenu.txt", hWnd=hWnd at entry=0x0, p_ad=<optimized out>, cpu=cpu at entry=8304) at kofola/Menu.cpp:5810
#4  0x0000562c767771b7 in winmain_Game_Run (p_Level_Name=0x562c76bf3148 <ber+1558248> "") at kofola/game_main.cpp:252
#5  0x0000562c7671b293 in main (argc=<optimized out>, argv=<optimized out>) at komat/Berusky3d_ini.cpp:360


(gdb) up
#1  0x0000562c767ea5e4 in ddxPublish () at tmp/compat.cpp:196
196       flip();
(gdb) down
#0  0x0000562c7679292e in flip () at komat/Berusky3d_ini.cpp:46
46        GRAPH3D *p_grf = p_age->graph_get();
(gdb) display/i $pc
1: x/i $pc
=> 0x562c7679292e <flip()+14>:  mov    0x10(%rax),%rdi

(gdb) print $rax
$1 = 0
(gdb) print p_age
$2 = <optimized out>
(gdb) print p_grf
$3 = <optimized out>


(gdb) list 43,53
43      void flip(void)
44      {
45        AGE_MAIN *p_age = p_ber->p_age;
46        GRAPH3D *p_grf = p_age->graph_get();
47
48        p_grf->flip();
49
50        static TIMER tm(hwconf.game_fps);
51        tm.frame_end(TRUE);
52        tm.frame_start();
53      }

(gdb) print p_ber
$4 = (G_KONFIG *) 0x562c76a76a60 <ber>
(gdb) print p_ber->p_age
$5 = (AGE_MAIN *) 0x0


##############


$ valgrind berusky2     
==15658== Memcheck, a memory error detector
...
Setting Listener...
==15658== Conditional jump or move depends on uninitialised value(s)
==15658==    at 0x48A9A45: ??? (in /usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==15658==    by 0x48AA17E: ??? (in /usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==15658==    by 0x48AAA2A: ??? (in /usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==15658==    by 0x4880FAB: SDL_PumpEvents (in /usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==15658==    by 0x4880FE8: SDL_PollEvent (in /usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0.11.4)
==15658==    by 0x18D1EF: spracuj_spravy(int) (Berusky3d_ini.cpp:429)
==15658==    by 0x17113B: winmain_Game_Run(char*) (game_main.cpp:187)
==15658==    by 0x115292: main (Berusky3d_ini.cpp:360)
==15658== 
I don't know what this event is!
==15658== Conditional jump or move depends on uninitialised value(s)
==15658==    at 0xAC6CBF3: ??? (in /usr/lib/x86_64-linux-gnu/libLLVM-7.so.1)
==15658==    by 0xABC9DF8: llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (in /usr/lib/x86_64-linux-gnu/libLLVM-7.so.1)
==15658==    by 0xAA5A667: llvm::FPPassManager::runOnFunction(llvm::Function&) (in /usr/lib/x86_64-linux-gnu/libLLVM-7.so.1)
==15658==    by 0xAA5A8C2: llvm::FPPassManager::runOnModule(llvm::Module&) (in /usr/lib/x86_64-linux-gnu/libLLVM-7.so.1)
==15658==    by 0xAA5AC8A: llvm::legacy::PassManagerImpl::run(llvm::Module&) (in /usr/lib/x86_64-linux-gnu/libLLVM-7.so.1)
==15658==    by 0xB8BB177: llvm::MCJIT::emitObject(llvm::Module*) (in /usr/lib/x86_64-linux-gnu/libLLVM-7.so.1)
==15658==    by 0xB8BB3D3: llvm::MCJIT::generateCodeForModule(llvm::Module*) (in /usr/lib/x86_64-linux-gnu/libLLVM-7.so.1)
==15658==    by 0xB8BBD7D: llvm::MCJIT::finalizeObject() (in /usr/lib/x86_64-linux-gnu/libLLVM-7.so.1)
==15658==    by 0xB89ADAF: LLVMGetPointerToGlobal (in /usr/lib/x86_64-linux-gnu/libLLVM-7.so.1)
==15658==    by 0x93241C5: ??? (in /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so)
==15658==    by 0x931C217: ??? (in /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so)
==15658==    by 0x9308677: ??? (in /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so)
==15658== 
Kofola: - Load bitmap pro herni menu
Kofola: - Load bitmap pro herni menu
AL lib: (EE) ALCplaybackAlsa_mixerProc: available update failed: Broken pipe
--------------Total load time 3.4 s -----------------
APAK: font_en.pak
Velikost AFAT: 2.6KB
Velikost Archivu: 0.4MB
Souboru: 7
Adresaru: 0
Uzlu: 2
==15658== Conditional jump or move depends on uninitialised value(s)
==15658==    at 0x483DE29: wcslen (vg_replace_strmem.c:1868)
==15658==    by 0x176B32: Find_First_Valid_CharU(int, wchar_t*) (menu_script.cpp:32)
==15658==    by 0x176D7E: Find_Next_ExpresionU(wchar_t*, int, wchar_t*) (menu_script.cpp:130)
==15658==    by 0x17A424: trig_Parse_LineU(wchar_t*, COMMAND*, GAME_TRIGER*, GRAMMAR*, TRIGER_STRUCTURE*) (trigers.cpp:95)
==15658==    by 0x152B35: fn_Load_Triger(char*, GAME_TRIGER*, GRAMMAR*, TRIGER_STRUCTURE*) (font.cpp:462)
==15658==    by 0x152C35: fn_Set_Font(char*) (font.cpp:503)
==15658==    by 0x171179: winmain_Game_Run(char*) (game_main.cpp:224)
==15658==    by 0x115292: main (Berusky3d_ini.cpp:360)
==15658== 
==15658== Conditional jump or move depends on uninitialised value(s)
==15658==    at 0x483DE29: wcslen (vg_replace_strmem.c:1868)
==15658==    by 0x176C72: Find_First_SeparatorU(int, wchar_t*) (menu_script.cpp:74)
==15658==    by 0x176D92: Find_Next_ExpresionU(wchar_t*, int, wchar_t*) (menu_script.cpp:133)
==15658==    by 0x17A424: trig_Parse_LineU(wchar_t*, COMMAND*, GAME_TRIGER*, GRAMMAR*, TRIGER_STRUCTURE*) (trigers.cpp:95)
==15658==    by 0x152B35: fn_Load_Triger(char*, GAME_TRIGER*, GRAMMAR*, TRIGER_STRUCTURE*) (font.cpp:462)
==15658==    by 0x152C35: fn_Set_Font(char*) (font.cpp:503)
==15658==    by 0x171179: winmain_Game_Run(char*) (game_main.cpp:224)
==15658==    by 0x115292: main (Berusky3d_ini.cpp:360)
==15658== 
==15658== Conditional jump or move depends on uninitialised value(s)
==15658==    at 0x483DE29: wcslen (vg_replace_strmem.c:1868)
==15658==    by 0x176B32: Find_First_Valid_CharU(int, wchar_t*) (menu_script.cpp:32)
==15658==    by 0x176D7E: Find_Next_ExpresionU(wchar_t*, int, wchar_t*) (menu_script.cpp:130)
==15658==    by 0x17A525: trig_Parse_LineU(wchar_t*, COMMAND*, GAME_TRIGER*, GRAMMAR*, TRIGER_STRUCTURE*) (trigers.cpp:104)
==15658==    by 0x152B35: fn_Load_Triger(char*, GAME_TRIGER*, GRAMMAR*, TRIGER_STRUCTURE*) (font.cpp:462)
==15658==    by 0x152C35: fn_Set_Font(char*) (font.cpp:503)
==15658==    by 0x171179: winmain_Game_Run(char*) (game_main.cpp:224)
==15658==    by 0x115292: main (Berusky3d_ini.cpp:360)
==15658== 
==15658== Conditional jump or move depends on uninitialised value(s)
==15658==    at 0x483DE29: wcslen (vg_replace_strmem.c:1868)
==15658==    by 0x176C72: Find_First_SeparatorU(int, wchar_t*) (menu_script.cpp:74)
==15658==    by 0x176D92: Find_Next_ExpresionU(wchar_t*, int, wchar_t*) (menu_script.cpp:133)
==15658==    by 0x17A525: trig_Parse_LineU(wchar_t*, COMMAND*, GAME_TRIGER*, GRAMMAR*, TRIGER_STRUCTURE*) (trigers.cpp:104)
==15658==    by 0x152B35: fn_Load_Triger(char*, GAME_TRIGER*, GRAMMAR*, TRIGER_STRUCTURE*) (font.cpp:462)
==15658==    by 0x152C35: fn_Set_Font(char*) (font.cpp:503)
==15658==    by 0x171179: winmain_Game_Run(char*) (game_main.cpp:224)
==15658==    by 0x115292: main (Berusky3d_ini.cpp:360)
==15658== 
b2_2d_font.pTTable = 0x1415b0d0
set font = font_en.pak
AL lib: (EE) ALCplaybackAlsa_mixerProc: available update failed: Broken pipe
APAK: font_system_en.pak
Velikost AFAT: 2.6KB
Velikost Archivu: 0.1MB
Souboru: 7
Adresaru: 0
Uzlu: 2
b2_2d_font.pTTable = 0x146cd8f0
set font = font_system_en.pak
==15658== Invalid read of size 8
==15658==    at 0x18C92E: flip() (Berusky3d_ini.cpp:46)
==15658==    by 0x1E45E3: ddxPublish() (compat.cpp:196)
==15658==    by 0x1E46A8: DisplayFrame() (compat.cpp:120)
==15658==    by 0x131373: RunMenu(char*, void*, AUDIO_DATA*, int) (Menu.cpp:5810)
==15658==    by 0x1711B6: winmain_Game_Run(char*) (game_main.cpp:252)
==15658==    by 0x115292: main (Berusky3d_ini.cpp:360)
==15658==  Address 0x10 is not stack'd, malloc'd or (recently) free'd
==15658== 
==15658== 
==15658== Process terminating with default action of signal 11 (SIGSEGV)
==15658==    at 0x507D5A9: raise (raise.c:46)
==15658==    by 0x507D72F: ??? (in /usr/lib/x86_64-linux-gnu/libpthread-2.28.so)
==15658==    by 0x18C92D: flip() (Berusky3d_ini.cpp:46)
==15658==    by 0x1E45E3: ddxPublish() (compat.cpp:196)
==15658==    by 0x1E46A8: DisplayFrame() (compat.cpp:120)
==15658==    by 0x131373: RunMenu(char*, void*, AUDIO_DATA*, int) (Menu.cpp:5810)
==15658==    by 0x1711B6: winmain_Game_Run(char*) (game_main.cpp:252)
==15658==    by 0x115292: main (Berusky3d_ini.cpp:360)
==15658== 
==15658== HEAP SUMMARY:
==15658==     in use at exit: 90,468,440 bytes in 5,336 blocks
==15658==   total heap usage: 66,114 allocs, 60,778 frees, 302,844,671 bytes allocated
==15658== 
==15658== LEAK SUMMARY:
==15658==    definitely lost: 174,964 bytes in 241 blocks
==15658==    indirectly lost: 13,798,000 bytes in 903 blocks
==15658==      possibly lost: 18,859,566 bytes in 34 blocks
==15658==    still reachable: 57,635,910 bytes in 4,158 blocks
==15658==         suppressed: 0 bytes in 0 blocks
==15658== Rerun with --leak-check=full to see details of leaked memory
==15658== 
==15658== For counts of detected and suppressed errors, rerun with: -v
==15658== Use --track-origins=yes to see where uninitialised values come from
==15658== ERROR SUMMARY: 2321 errors from 7 contexts (suppressed: 2 from 2)
Segmentation fault (core dumped)



############


gdb -q --args berusky2

set width 0
set pagination off
directory /home/benutzer/source/berusky2/orig/berusky2-0.10/src

b main
run

b 320
cont

bt


###########

benutzer at debian:~$ gdb -q --args berusky2 
Reading symbols from berusky2...Reading symbols from /usr/lib/debug/.build-id/fe/7a986b9cee0e540ccd0309c5919cfdf67e5898.debug...done.
done.
(gdb) set width 0
(gdb) set pagination off
(gdb) directory /home/benutzer/source/berusky2/orig/berusky2-0.10/src
Source directories searched: /home/benutzer/source/berusky2/orig/berusky2-0.10/src:$cdir:$cwd
(gdb) b main  
Breakpoint 1 at 0xd060: file komat/Berusky3d_ini.cpp, line 302.
(gdb) run
Starting program: /usr/games/berusky2 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, main (argc=1, argv=0x7fffffffe588) at komat/Berusky3d_ini.cpp:302
302       atexit(game_exit);
(gdb) next
304       print_banner();
(gdb) 
Berusky 2 v.0.10 (C) Anakreon 2011, http://www.anakreon.cz/
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

305       process_params(p_ber, argc, argv);
(gdb) 
307       if (create_user_data) {
(gdb) 
308         user_directory_create();
(gdb) 
Checking /home/benutzer/.berusky2/...ok
Checking /home/benutzer/.berusky2/Save/...ok
Checking /home/benutzer/.berusky2/Save/profiles/...ok
Checking ~/.berusky2/berusky3d.ini...OK
311       ini_file_init();
(gdb) 
Trying to open ini file at /home/benutzer/.berusky2//berusky3d.ini...OK
313       working_dir_init();
(gdb) 
314       debug_file_init();
(gdb) 
316       nahraj_konfig();
(gdb) 
318       AGE_MAIN *p_age = p_ber->p_age = new AGE_MAIN(main_callback);
(gdb) next
320       p_age->graph_set(SCREEN_XRES, SCREEN_YRES, hwconf.bpp, hwconf.fullscreen);
(gdb) print p_ber
$1 = (G_KONFIG *) 0x5555558bca60 <ber>
(gdb) print p_ber->p_age
$2 = (AGE_MAIN *) 0x555555a761b0
(gdb) print &(p_ber->p_age)
$3 = (AGE_MAIN **) 0x5555558bca60 <ber>
(gdb) watch *0x5555558bca60
Hardware watchpoint 2: *0x5555558bca60
(gdb) cont
...
Setting Listener...
I don't know what this event is!
[New Thread 0x7fffd60c0700 (LWP 15416)]

Thread 1 "berusky2" hit Hardware watchpoint 2: *0x5555558bca60

Old value = 1437032880
New value = 0
__memset_sse2_unaligned_erms () at ../sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S:201
201     ../sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S: No such file or directory.
(gdb) bt
#0  __memset_sse2_unaligned_erms () at ../sysdeps/x86_64/multiarch/memset-vec-unaligned-erms.S:201
#1  0x00005555556c648e in ogg_playback () at adas/ogg_io.c:123
#2  0x00005555556c1ed8 in ap_Play_Song (Index=Index at entry=0, Random=Random at entry=0 '\000', p_ad=0x5555558a2c60 <ad>) at kofola/audio_plug-in.cpp:221
#3  0x00005555555bd15d in winmain_Game_Run (p_Level_Name=0x555555a39148 <ber+1558248> "") at kofola/game_main.cpp:220
#4  0x0000555555561293 in main (argc=<optimized out>, argv=<optimized out>) at komat/Berusky3d_ini.cpp:360


############


gdb -q --args berusky2

set width 0
set pagination off
directory /home/benutzer/source/berusky2/orig/berusky2-0.10/src
b *(ogg_playback+201)
display/i $pc
run



Setting Listener...
I don't know what this event is!
[New Thread 0x7fffd58bf700 (LWP 15484)]

Thread 1 "berusky2" hit Breakpoint 1, 0x00005555556c6489 in ogg_playback () at adas/ogg_io.c:123
123             SetThreadPriority(thread,THREAD_PRIORITY_HIGHEST);
1: x/i $pc
=> 0x5555556c6489 <ogg_playback+201>:   callq  0x555555561037 <SetThreadPriority>
(gdb) stepi
0x0000555555561037 in SetThreadPriority ()
1: x/i $pc
=> 0x555555561037 <SetThreadPriority>:  nopw   0x0(%rax,%rax,1)
(gdb) 
memset (__len=1562344, __ch=0, __dest=0x5555558bca60 <ber>) at /usr/include/x86_64-linux-gnu/bits/string_fortified.h:71
warning: Source file is more recent than executable.
71        return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
1: x/i $pc
=> 0x555555561040 <_GLOBAL__sub_I_ber()>:       mov    $0x17d6e8,%edx
(gdb) 
0x0000555555561045      71        return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
1: x/i $pc
=> 0x555555561045 <_GLOBAL__sub_I_ber()+5>:     xor    %esi,%esi
(gdb) 
0x0000555555561047      71        return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
1: x/i $pc
=> 0x555555561047 <_GLOBAL__sub_I_ber()+7>:     lea    0x35ba12(%rip),%rdi        # 0x5555558bca60 <ber>
(gdb) 
0x000055555556104e      71        return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
1: x/i $pc
=> 0x55555556104e <_GLOBAL__sub_I_ber()+14>:    jmpq   0x55555555f440 <memset at plt>
(gdb) 
0x000055555555f440 in memset at plt ()
1: x/i $pc
=> 0x55555555f440 <memset at plt>: jmpq   *0x1aedda(%rip)        # 0x55555570e220 <memset at got.plt>

(gdb) disassemble SetThreadPriority
Dump of assembler code for function SetThreadPriority:
   0x0000555555561037 <+0>:     nopw   0x0(%rax,%rax,1)
End of assembler dump.


##############


https://buildd.debian.org/status/fetch.php?pkg=berusky2&arch=amd64&ver=0.10-8&stamp=1573691122&raw=0

tmp/compat_mini.cpp: In function ‘int CloseHandle(THREAD_HANDLE)’:
tmp/compat_mini.cpp:96:1: warning: no return statement in function returning non-void [-Wreturn-type]
   96 | }
      | ^
tmp/compat_mini.cpp: In function ‘int SetThreadPriority(THREAD_HANDLE, int)’:
tmp/compat_mini.cpp:106:1: warning: no return statement in function returning non-void [-Wreturn-type]
  106 | }
      | ^
tmp/compat_mini.cpp: In function ‘int GetThreadPriority(THREAD_HANDLE)’:
tmp/compat_mini.cpp:110:1: warning: no return statement in function returning non-void [-Wreturn-type]
  110 | }
      | ^
.



###############


cd /home/benutzer/source/berusky2/
cp orig try1 -a
cd try1/berusky2-0.10
dpkg-source --commit

944431-avoid-no-return-statement-in-function-returning-non-void.patch
Avoid 'no return statement in function returning non-void'

dpkg-buildpackage

dpkg -i /home/benutzer/source/berusky2/try1/berusky2{,-dbgsym}_0.10-7_amd64.deb


More information about the Pkg-games-devel mailing list