Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alpha version of Linux #282

Merged
merged 32 commits into from
Dec 12, 2018
Merged

Alpha version of Linux #282

merged 32 commits into from
Dec 12, 2018

Conversation

eagleivg
Copy link
Contributor

This PR is fix of many various crashes at Linux. The game no longer crashes in random places.

@Zegeri
Copy link
Contributor

Zegeri commented Nov 24, 2018

I'm getting a crash at thestd::locale construction while starting the engine.

Crash report (Click to expand)
Loading DLL: xrGame
Executing config-script "\media2\wine64\drive_c\GOG Games\S.T.A.L.K.E.R. Call of Pripyat\gamedata\configs\default_controls.ltx"...
munmap_chunk(): invalid pointer
 
FATAL ERROR
 
[error] Expression    : <no expression>
[error] Function      : handler_base
[error] File          : /media2/xray-16/src/xrCore/xrDebug.cpp
[error] Line          : 781
[error] Description   : application is aborting
 

stack trace:

/media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrCore.so(_ZN7xrDebug10GatherInfoEPcmRK13ErrorLocationPKcS5_S5_S5_+0x1c8) [0x7f94aff1fc08]
/media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrCore.so(_ZN7xrDebug4FailERbRK13ErrorLocationPKcS5_S5_S5_+0x8a) [0x7f94aff1fdca]
/media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrCore.so(+0x3c1b7) [0x7f94aff201b7]
/usr/lib/libc.so.6(+0x37e00) [0x7f94aeb50e00]
/usr/lib/libc.so.6(gsignal+0x10f) [0x7f94aeb50d7f]
/usr/lib/libc.so.6(abort+0x125) [0x7f94aeb3b672]
/usr/lib/libc.so.6(+0x7a878) [0x7f94aeb93878]
/usr/lib/libc.so.6(+0x8118a) [0x7f94aeb9a18a]
/usr/lib/libc.so.6(+0x816e4) [0x7f94aeb9a6e4]
/usr/lib/libstdc++.so.6(_ZNSt6localeC2EPKc+0x827) [0x7f94aef23517]
/media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrEngine.so(_ZN6CInput12get_dik_nameEiPci+0x5a) [0x7f94b0f0639a]
/media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so(+0x11f1d5f) [0x7f94a04d6d5f]
/media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so(+0x11f3285) [0x7f94a04d8285]
/media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrEngine.so(_ZN8CConsole14ExecuteCommandEPKcb+0x206) [0x7f94b0ebcee6]
/media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrEngine.so(_ZN11CCC_LoadCFG7ExecuteEPKc+0x1ef) [0x7f94b0f0813f]
/media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrEngine.so(_ZN8CConsole14ExecuteCommandEPKcb+0x206) [0x7f94b0ebcee6]
/media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so(+0x11f2cde) [0x7f94a04d7cde]
/media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrEngine.so(_ZN8CConsole14ExecuteCommandEPKcb+0x348) [0x7f94b0ebd028]
/media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrEngine.so(_Z7Startupv+0x34) [0x7f94b0eed7d4]
/media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrEngine.so(_Z14RunApplicationv+0x138) [0x7f94b0eedf88]
Valgrind Report (Click to expand)
Executing config-script "user.ltx"...
[\media2\wine64\drive_c\GOG Games\S.T.A.L.K.E.R. Call of Pripyat\_appdata_\user.ltx] successfully loaded.
Loading DLL: xrGame
Executing config-script "\media2\wine64\drive_c\GOG Games\S.T.A.L.K.E.R. Call of Pripyat\gamedata\configs\default_controls.ltx"...
==6668== Invalid read of size 8
==6668==    at 0x61F8190: ??? (in /usr/lib/libtbbmalloc.so.2)
==6668==    by 0x61FAAFD: ??? (in /usr/lib/libtbbmalloc.so.2)
==6668==    by 0x534BC93: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrScriptEngine.so)
==6668==    by 0x57D7542: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrCore.so)
==6668==    by 0x683342C: append (basic_string.h:1213)
==6668==    by 0x683342C: operator+= (basic_string.h:1160)
==6668==    by 0x683342C: std::locale::locale(char const*) (localename.cc:115)
==6668==    by 0x48FD576: CInput::get_dik_name(int, char*, int) (xr_input.cpp:198)
==6668==    by 0x15700D5E: remap_keys() (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x15702284: CCC_Bind::Execute(char const*) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x48B3EE5: CConsole::ExecuteCommand(char const*, bool) (XR_IOConsole.cpp:571)
==6668==    by 0x48FF19E: CCC_LoadCFG::Execute(char const*) (xr_ioc_cmd.cpp:267)
==6668==    by 0x48B3EE5: CConsole::ExecuteCommand(char const*, bool) (XR_IOConsole.cpp:571)
==6668==    by 0x15701CDD: CCC_DefControls::Execute(char const*) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==  Address 0x8672bf8 is 8 bytes before a block of size 129 alloc'd
==6668==    at 0x4837DEF: operator new(unsigned long) (vg_replace_malloc.c:334)
==6668==    by 0x68B6E35: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::reserve(unsigned long) (basic_string.tcc:293)
==6668==    by 0x683306B: std::locale::locale(char const*) (localename.cc:95)
==6668==    by 0x48FD576: CInput::get_dik_name(int, char*, int) (xr_input.cpp:198)
==6668==    by 0x15700D5E: remap_keys() (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x15702284: CCC_Bind::Execute(char const*) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x48B3EE5: CConsole::ExecuteCommand(char const*, bool) (XR_IOConsole.cpp:571)
==6668==    by 0x48FF19E: CCC_LoadCFG::Execute(char const*) (xr_ioc_cmd.cpp:267)
==6668==    by 0x48B3EE5: CConsole::ExecuteCommand(char const*, bool) (XR_IOConsole.cpp:571)
==6668==    by 0x15701CDD: CCC_DefControls::Execute(char const*) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x48B4027: CConsole::ExecuteCommand(char const*, bool) (XR_IOConsole.cpp:560)
==6668==    by 0x48E47D3: execUserScript (main.cpp:150)
==6668==    by 0x48E47D3: Startup() (main.cpp:179)
==6668== 
==6668== Invalid read of size 2
==6668==    at 0x61FAB3A: ??? (in /usr/lib/libtbbmalloc.so.2)
==6668==    by 0x534BC93: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrScriptEngine.so)
==6668==    by 0x57D7542: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrCore.so)
==6668==    by 0x683342C: append (basic_string.h:1213)
==6668==    by 0x683342C: operator+= (basic_string.h:1160)
==6668==    by 0x683342C: std::locale::locale(char const*) (localename.cc:115)
==6668==    by 0x48FD576: CInput::get_dik_name(int, char*, int) (xr_input.cpp:198)
==6668==    by 0x15700D5E: remap_keys() (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x15702284: CCC_Bind::Execute(char const*) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x48B3EE5: CConsole::ExecuteCommand(char const*, bool) (XR_IOConsole.cpp:571)
==6668==    by 0x48FF19E: CCC_LoadCFG::Execute(char const*) (xr_ioc_cmd.cpp:267)
==6668==    by 0x48B3EE5: CConsole::ExecuteCommand(char const*, bool) (XR_IOConsole.cpp:571)
==6668==    by 0x15701CDD: CCC_DefControls::Execute(char const*) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x48B4027: CConsole::ExecuteCommand(char const*, bool) (XR_IOConsole.cpp:560)
==6668==  Address 0x867007a is 26 bytes after a block of size 48 in arena "client"
==6668== 
==6668== Invalid read of size 8
==6668==    at 0x61FAB4B: ??? (in /usr/lib/libtbbmalloc.so.2)
==6668==    by 0x534BC93: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrScriptEngine.so)
==6668==    by 0x57D7542: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrCore.so)
==6668==    by 0x683342C: append (basic_string.h:1213)
==6668==    by 0x683342C: operator+= (basic_string.h:1160)
==6668==    by 0x683342C: std::locale::locale(char const*) (localename.cc:115)
==6668==    by 0x48FD576: CInput::get_dik_name(int, char*, int) (xr_input.cpp:198)
==6668==    by 0x15700D5E: remap_keys() (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x15702284: CCC_Bind::Execute(char const*) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x48B3EE5: CConsole::ExecuteCommand(char const*, bool) (XR_IOConsole.cpp:571)
==6668==    by 0x48FF19E: CCC_LoadCFG::Execute(char const*) (xr_ioc_cmd.cpp:267)
==6668==    by 0x48B3EE5: CConsole::ExecuteCommand(char const*, bool) (XR_IOConsole.cpp:571)
==6668==    by 0x15701CDD: CCC_DefControls::Execute(char const*) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x48B4027: CConsole::ExecuteCommand(char const*, bool) (XR_IOConsole.cpp:560)
==6668==  Address 0x8670060 is 0 bytes after a block of size 48 alloc'd
==6668==    at 0x4837DEF: operator new(unsigned long) (vg_replace_malloc.c:334)
==6668==    by 0x5398188: luabind::detail::allocate_class_id(luabind::type_id const&) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/luabind.so)
==6668==    by 0x14F5B4EE: _GLOBAL__sub_I_xrServer_Objects_ALife_Items_script.cpp (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x4010549: call_init.part.0 (in /usr/lib/ld-2.28.so)
==6668==    by 0x4010649: _dl_init (in /usr/lib/ld-2.28.so)
==6668==    by 0x4014532: dl_open_worker (in /usr/lib/ld-2.28.so)
==6668==    by 0x6BF3F56: _dl_catch_exception (in /usr/lib/libc-2.28.so)
==6668==    by 0x4013DFE: _dl_open (in /usr/lib/ld-2.28.so)
==6668==    by 0x58B8159: ??? (in /usr/lib/libdl-2.28.so)
==6668==    by 0x6BF3F56: _dl_catch_exception (in /usr/lib/libc-2.28.so)
==6668==    by 0x6BF3FF2: _dl_catch_error (in /usr/lib/libc-2.28.so)
==6668==    by 0x58B88BE: ??? (in /usr/lib/libdl-2.28.so)
==6668== 
==6668== Invalid read of size 8
==6668==    at 0x61FAB5B: ??? (in /usr/lib/libtbbmalloc.so.2)
==6668==    by 0x534BC93: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrScriptEngine.so)
==6668==    by 0x57D7542: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrCore.so)
==6668==    by 0x683342C: append (basic_string.h:1213)
==6668==    by 0x683342C: operator+= (basic_string.h:1160)
==6668==    by 0x683342C: std::locale::locale(char const*) (localename.cc:115)
==6668==    by 0x48FD576: CInput::get_dik_name(int, char*, int) (xr_input.cpp:198)
==6668==    by 0x15700D5E: remap_keys() (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x15702284: CCC_Bind::Execute(char const*) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x48B3EE5: CConsole::ExecuteCommand(char const*, bool) (XR_IOConsole.cpp:571)
==6668==    by 0x48FF19E: CCC_LoadCFG::Execute(char const*) (xr_ioc_cmd.cpp:267)
==6668==    by 0x48B3EE5: CConsole::ExecuteCommand(char const*, bool) (XR_IOConsole.cpp:571)
==6668==    by 0x15701CDD: CCC_DefControls::Execute(char const*) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x48B4027: CConsole::ExecuteCommand(char const*, bool) (XR_IOConsole.cpp:560)
==6668==  Address 0x8670068 is 8 bytes after a block of size 48 alloc'd
==6668==    at 0x4837DEF: operator new(unsigned long) (vg_replace_malloc.c:334)
==6668==    by 0x5398188: luabind::detail::allocate_class_id(luabind::type_id const&) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/luabind.so)
==6668==    by 0x14F5B4EE: _GLOBAL__sub_I_xrServer_Objects_ALife_Items_script.cpp (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x4010549: call_init.part.0 (in /usr/lib/ld-2.28.so)
==6668==    by 0x4010649: _dl_init (in /usr/lib/ld-2.28.so)
==6668==    by 0x4014532: dl_open_worker (in /usr/lib/ld-2.28.so)
==6668==    by 0x6BF3F56: _dl_catch_exception (in /usr/lib/libc-2.28.so)
==6668==    by 0x4013DFE: _dl_open (in /usr/lib/ld-2.28.so)
==6668==    by 0x58B8159: ??? (in /usr/lib/libdl-2.28.so)
==6668==    by 0x6BF3F56: _dl_catch_exception (in /usr/lib/libc-2.28.so)
==6668==    by 0x6BF3FF2: _dl_catch_error (in /usr/lib/libc-2.28.so)
==6668==    by 0x58B88BE: ??? (in /usr/lib/libdl-2.28.so)
==6668== 
==6668== Invalid read of size 8
==6668==    at 0x61F87E6: ??? (in /usr/lib/libtbbmalloc.so.2)
==6668==    by 0x61FAB75: ??? (in /usr/lib/libtbbmalloc.so.2)
==6668==    by 0x534BC93: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrScriptEngine.so)
==6668==    by 0x57D7542: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrCore.so)
==6668==    by 0x683342C: append (basic_string.h:1213)
==6668==    by 0x683342C: operator+= (basic_string.h:1160)
==6668==    by 0x683342C: std::locale::locale(char const*) (localename.cc:115)
==6668==    by 0x48FD576: CInput::get_dik_name(int, char*, int) (xr_input.cpp:198)
==6668==    by 0x15700D5E: remap_keys() (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x15702284: CCC_Bind::Execute(char const*) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x48B3EE5: CConsole::ExecuteCommand(char const*, bool) (XR_IOConsole.cpp:571)
==6668==    by 0x48FF19E: CCC_LoadCFG::Execute(char const*) (xr_ioc_cmd.cpp:267)
==6668==    by 0x48B3EE5: CConsole::ExecuteCommand(char const*, bool) (XR_IOConsole.cpp:571)
==6668==    by 0x15701CDD: CCC_DefControls::Execute(char const*) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==  Address 0x8670010 is 32 bytes before a block of size 48 in arena "client"
==6668== 
==6668== Invalid read of size 8
==6668==    at 0x61F87FA: ??? (in /usr/lib/libtbbmalloc.so.2)
==6668==    by 0x61FAB75: ??? (in /usr/lib/libtbbmalloc.so.2)
==6668==    by 0x534BC93: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrScriptEngine.so)
==6668==    by 0x57D7542: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrCore.so)
==6668==    by 0x683342C: append (basic_string.h:1213)
==6668==    by 0x683342C: operator+= (basic_string.h:1160)
==6668==    by 0x683342C: std::locale::locale(char const*) (localename.cc:115)
==6668==    by 0x48FD576: CInput::get_dik_name(int, char*, int) (xr_input.cpp:198)
==6668==    by 0x15700D5E: remap_keys() (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x15702284: CCC_Bind::Execute(char const*) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x48B3EE5: CConsole::ExecuteCommand(char const*, bool) (XR_IOConsole.cpp:571)
==6668==    by 0x48FF19E: CCC_LoadCFG::Execute(char const*) (xr_ioc_cmd.cpp:267)
==6668==    by 0x48B3EE5: CConsole::ExecuteCommand(char const*, bool) (XR_IOConsole.cpp:571)
==6668==    by 0x15701CDD: CCC_DefControls::Execute(char const*) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==  Address 0x8670010 is 32 bytes before a block of size 48 in arena "client"
==6668== 
==6668== Invalid free() / delete / delete[] / realloc()
==6668==    at 0x4838EAB: operator delete(void*) (vg_replace_malloc.c:576)
==6668==    by 0x6833516: deallocate (new_allocator.h:125)
==6668==    by 0x6833516: deallocate (alloc_traits.h:462)
==6668==    by 0x6833516: _M_destroy (basic_string.h:226)
==6668==    by 0x6833516: _M_dispose (basic_string.h:221)
==6668==    by 0x6833516: ~basic_string (basic_string.h:657)
==6668==    by 0x6833516: std::locale::locale(char const*) (localename.cc:94)
==6668==    by 0x48FD576: CInput::get_dik_name(int, char*, int) (xr_input.cpp:198)
==6668==    by 0x15700D5E: remap_keys() (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x15702284: CCC_Bind::Execute(char const*) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x48B3EE5: CConsole::ExecuteCommand(char const*, bool) (XR_IOConsole.cpp:571)
==6668==    by 0x48FF19E: CCC_LoadCFG::Execute(char const*) (xr_ioc_cmd.cpp:267)
==6668==    by 0x48B3EE5: CConsole::ExecuteCommand(char const*, bool) (XR_IOConsole.cpp:571)
==6668==    by 0x15701CDD: CCC_DefControls::Execute(char const*) (in /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so)
==6668==    by 0x48B4027: CConsole::ExecuteCommand(char const*, bool) (XR_IOConsole.cpp:560)
==6668==    by 0x48E47D3: execUserScript (main.cpp:150)
==6668==    by 0x48E47D3: Startup() (main.cpp:179)
==6668==    by 0x48E4F87: RunApplication() (main.cpp:290)
==6668==  Address 0x10c66200 is in a rw- anonymous segment
==6668== 
GDB report (Click to expand)
Program terminated with signal SIGTRAP, Trace/breakpoint trap.
#0  0x00007f94aff1fe09 in xrDebug::Fail(bool&, ErrorLocation const&, char const*, char const*, char const*, char const*) ()
   from /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrCore.so
[Current thread is 1 (Thread 0x7f94ad4f3040 (LWP 9334))]
(gdb) back
#0  0x00007f94aff1fe09 in xrDebug::Fail(bool&, ErrorLocation const&, char const*, char const*, char const*, char const*) ()
   from /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrCore.so
#1  0x00007f94aff201b7 in abort_handler(int) () from /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrCore.so
#2  <signal handler called>
#3  0x00007f94aeb50d7f in raise () from /usr/lib/libc.so.6
#4  0x00007f94aeb3b672 in abort () from /usr/lib/libc.so.6
#5  0x00007f94aeb93878 in __libc_message () from /usr/lib/libc.so.6
#6  0x00007f94aeb9a18a in malloc_printerr () from /usr/lib/libc.so.6
#7  0x00007f94aeb9a6e4 in munmap_chunk () from /usr/lib/libc.so.6
#8  0x00007f94aef23517 in __gnu_cxx::new_allocator<char>::deallocate (this=0x7ffca776d090, __p=<optimized out>)
    at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/ext/new_allocator.h:116
#9  std::allocator_traits<std::allocator<char> >::deallocate (__a=..., __n=<optimized out>, __p=<optimized out>)
    at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/alloc_traits.h:462
#10 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_destroy (__size=<optimized out>, 
    this=0x7ffca776d090) at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:226
#11 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_dispose (this=0x7ffca776d090)
    at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:221
#12 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string (this=0x7ffca776d090, 
    __in_chrg=<optimized out>) at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:657
#13 std::locale::locale (this=0x7ffca776d128, __s=<optimized out>) at /build/gcc/src/gcc/libstdc++-v3/src/c++98/localename.cc:94
#14 0x00007f94b0f0639a in CInput::get_dik_name (this=<optimized out>, dik=513, dest_str=0x7ffca776d1c0 "", dest_sz=128)
    at /media2/xray-16/src/xrEngine/xr_input.cpp:198
#15 0x00007f94a04d6d5f in remap_keys() () from /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so
#16 0x00007f94a04d8285 in CCC_Bind::Execute(char const*) ()
   from /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so
#17 0x00007f94b0ebcee6 in CConsole::ExecuteCommand (this=0x7f94a2081600, cmd_str=<optimized out>, record_cmd=<optimized out>)
    at /media2/xray-16/src/xrEngine/XR_IOConsole.cpp:571
#18 0x00007f94b0f0813f in CCC_LoadCFG::Execute (this=0x7f94b0f51ea0 <CCC_Register()::xCCC_LoadCFG>, args=<optimized out>)
    at /media2/xray-16/src/xrEngine/xr_ioc_cmd.cpp:267
#19 0x00007f94b0ebcee6 in CConsole::ExecuteCommand (this=0x7f94a2081600, cmd_str=<optimized out>, record_cmd=<optimized out>)
    at /media2/xray-16/src/xrEngine/XR_IOConsole.cpp:571
#20 0x00007f94a04d7cde in CCC_DefControls::Execute(char const*) ()
   from /media2/wine64/drive_c/GOG Games/S.T.A.L.K.E.R. Call of Pripyat/xrGame.so
#21 0x00007f94b0ebd028 in CConsole::ExecuteCommand (this=0x7f94a2081600, cmd_str=<optimized out>, record_cmd=<optimized out>)
    at /media2/xray-16/src/xrEngine/XR_IOConsole.cpp:560

@@ -503,7 +503,7 @@ bool CScriptEngine::namespace_loaded(LPCSTR name, bool remove_from_stack)
int start = lua_gettop(lua());
lua_pushstring(lua(), GlobalNamespace);
lua_rawget(lua(), LUA_GLOBALSINDEX);
string256 S2;
string256 S2 = { 0 };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In C++ it's enough to do just = { } to initialize arrays with nulls.

@eagleivg eagleivg force-pushed the xd_dev branch 2 times, most recently from d4895db to 12eb46f Compare November 29, 2018 07:18
@@ -2799,7 +2799,7 @@ extern "C" ODE_API void dJointSetFixedQuaternionPos (dxJointFixed *joint,dQuater
// set joint->qrel to the transpose of the first body's q
joint->qrel[0] = quaternion[0];//joint->node[0].body->q[0];
for (i=1; i<4; i++) joint->qrel[i] = -quaternion[i];//-joint->node[0].body->q[i];
for (i=0; i<4; i++) joint->offset[i] = pos[i];//joint->node[0].body->posr.pos[i];
for (i=0; i<3; i++) joint->offset[i] = pos[i];//joint->node[0].body->posr.pos[i];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the magic number "3"? Can we use the expression like sizeof(array)/sizeof(array[0]) here? Or maybe define some constant?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not array, type of pos is a pointer to dReal, but it a pointer to the first component of the vector is passed to the function. Even if we pass the link to the Fvector itself there, we cannot calculate the size of the components, we need to know in advance how much to read.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sucks :( This 'style' should lead to a lot of typos. I believe we find a LOT of such bugs later.

@@ -45,7 +45,7 @@ if (WIN32)
set(_TBB_DEFAULT_INSTALL_DIR "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB")
set(_TBB_LIB_NAME "tbb")
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
set(_TBB_LIB_MALLOC_PROXY_NAME "${_TBB_LIB_NAME}malloc_proxy")
# set(_TBB_LIB_MALLOC_PROXY_NAME "${_TBB_LIB_NAME}malloc_proxy")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe remove this garbage instead of commenting it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure that I will not be required to return it.

@@ -85,7 +85,7 @@ inline void _splitpath(const char* path, // Path Input
)
{
if(!path)
return EINVAL;
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the NULL in path is expected behaviour? Seems like not - we don't report the error to the caller. So... Let's insert some type of assertion here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case is defined in MSDN in the following way:

If path is NULL, the invalid parameter handler is invoked, as described in Parameter Validation. If execution is allowed to continue, errno is set to EINVAL and the function returns EINVAL.

We're trying to reproduce that second case. Notice that it doesn't make sense, because _splitpath is supposed to return void. Maybe it should insert errno = EINVAL.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, reporting an error is an alternative solution. If this function tries to mimic the Windows implementation - I agree that it's the preferrable way.

@@ -85,7 +85,7 @@ inline void _splitpath(const char* path, // Path Input
)
{
if(!path)
return EINVAL;
return;

const char *p, *end;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's init the variables directly in this line

float f = 1.f;
ZeroMemory(bufFrame, sizeof(bufFrame));
MemFill32(bufDepth, *LPDWORD(&f), size);
MemFill32(bufDepth, *(u32 *)(&f), size);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static_cast, please

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static_cast will fill array integer numbers, but we need fill float value.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reinterpret_cast then?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reinterpret_cast doesn't seem to be a preferred solution - it's not the device driver's code to use such 'hard' types of casts. Maybe it's better to write a cycle here to avoid magic with pointers and the potential problems in the future? I believe the compiler is smart enough to optimize the cycle in the binary.

@@ -6,7 +6,7 @@ using namespace PAPI;
void ParticleAction::Load(IReader& F)
{
m_Flags.assign(F.r_u32());
type = (PActionEnum)F.r_u32();
type = PActionEnum(F.r_u32());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static_cast?

@@ -313,7 +313,7 @@ u32 CParticleManager::LoadActions(int alist_id, IReader& R)
u32 cnt = R.r_u32();
for (u32 k = 0; k < cnt; k++)
{
ParticleAction* act = CreateAction((PActionEnum)R.r_u32());
ParticleAction* act = CreateAction(PActionEnum(R.r_u32()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static_cast?

#ifdef LINUX
__attribute__((constructor))
#endif
static void load(int argc, char** argv, char** envp)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const char** ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But looks like we don't expect the modification of the arguments. So, making the arguments 'const' should help us to avoid occasional modifying data in the future. It makes our method safer. In addition, the 'const' variables allow the compiler to use advanced optimization techniques sometimes.

src/xr_3da/entry_point.cpp Outdated Show resolved Hide resolved
src/xr_3da/entry_point.cpp Outdated Show resolved Hide resolved
src/xrCore/LocatorAPI.cpp Outdated Show resolved Hide resolved
@xrombik
Copy link
Contributor

xrombik commented Dec 6, 2018

Possible calling free() for stack pointer in src/xr_3da/entry_point.cpp:

int main(int argc, char *argv[])
{
   int result = EXIT_FAILURE;

    try
    {
        char* commandLine = "";

and then:

free(commandLine);
}

It should be:

int main(int argc, char *argv[])
{
int result = EXIT_FAILURE;
try
{
    char* commandLine = NULL; 

and then

   if (commandLine)
          free(commandLine);

@xrombik
Copy link
Contributor

xrombik commented Dec 6, 2018

Думаю что

    char* commandLine = ""; 

и

   xr_free(commandLine);

всё равно не совместимы.

@eagleivg
Copy link
Contributor Author

eagleivg commented Dec 6, 2018

    char* commandLine = ""; 

Присмотрись внимательней, там этой строчки давно уже нет.

@eagleivg eagleivg merged commit 676cf70 into OpenXRay:xd_dev Dec 12, 2018
@eagleivg
Copy link
Contributor Author

I think, now changes more complicated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

9 participants