Debug build crashes before loading

Debug build crashes before loading

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Debug build crashes before loading

Post by Beherith »

With vs2005, release build works fine, but debug build always crashes very early on, in xstring.h. I dont get a proper stack trace for it:

Code: Select all

 	KernelBase.dll!7535b727() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for KernelBase.dll]	
 	KernelBase.dll!7535b727() 	
>	spring.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Eos(unsigned int _Newsize=110)  Line 1993 + 0x22 bytes	C++
 	spring.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & _Right="pU┬┐", unsigned int _Roff=25454928, unsigned int _Count=3765269347)  Line 1014	C++
 	spring.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::basic_string<char,std::char_traits<char>,std::allocator<char> >(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & _Right={...})  Line 597	C++
But if I do a step-by-step run, the last spring function called is:

Code: Select all

ConfigHandler::Instantiate(); in springapp.cpp
Stepping into that function results in a crash :(

This has only happened in builds more recent than a month.

Any thoughts?
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Debug build crashes before loading

Post by hoijui »

ehh, nice debugging there! :-)

i hope it is fixed by this:
https://github.com/spring/spring/commit ... b43f8fd087

if it is not, please come back again.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Debug build crashes before loading

Post by Beherith »

Thanks, now comes the really dumb question:
How can i update my git repo (bout a week old) while keeping my current work?
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Debug build crashes before loading

Post by jK »

Code: Select all

git stash
git pull
git rebase (needed for unpushed commits)
git stash pop
git mergetool (in case of merge problems)
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Debug build crashes before loading

Post by smoth »

Stash the same as making a patch(svn) or is it like a shelf(tfs)?
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Debug build crashes before loading

Post by Beherith »

Thanks jK!

The error still persists:

The message is:
Unhandled exception at 0x7535b727 in spring.exe: Microsoft C++ exception: std::runtime_error at memory location 0x0018f4c0..

Not useful, but the crash location is the same.
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Debug build crashes before loading

Post by abma »

is service pack 1 for visual-studio installed?

maybe something like this
http://stackoverflow.com/questions/5175 ... ource-file ?

Code: Select all

The STL classes, like vector<>, have a layout mismatch between the release and the debug builds, caused by iterator debugging support. Your problem behaves exactly like the kind of trouble you get into when you link a debug build of a .lib or DLL in the release build of your application and exchange an STL object between them. Heap corruption and access violation exceptions are the result.

Triple check your build settings and ensure that you only ever link the release build of the .libs in your Release build and the debug build of the .libs in your Debug build.

or are your code-changes the cause? maybe push them to github, so others can try them out...

wrong mingwlibs?
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Debug build crashes before loading

Post by Beherith »

No, installing sp1 now.

Code changes arent the problem, issue arises with vanilla code too.

Wrong mingwlibs? I dont think i use mingwlibs, I use vclibs latest from github.
zerver
Spring Developer
Posts: 1358
Joined: 16 Dec 2006, 20:59

Re: Debug build crashes before loading

Post by zerver »

I did have problems with this line of code a few weeks ago

Code: Select all

assert(configHandler->GetString("test") == "x y z");
try removing it...
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Debug build crashes before loading

Post by Beherith »

Thanks zerver, that was the culprit!
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Debug build crashes before loading

Post by abma »

@zerver:

damn!

i guess this was introduced by me...

can't currently fix it myself cause i'm lack of internet at home...

i added a "#ifdef DEBUG" around the definition of the test-var because... yeah because its a test-var. i didn't knew about that assertion. to fix, just remove the #ifdef DEBUG... (can't say which file that is...)

zerver: reverting https://github.com/spring/spring/commit ... 3324ffb88b should fix it... if it solves the "problem", please add a note to that line, that there is an check about that value...
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Debug build crashes before loading

Post by hoijui »

yeah i guess removing the ifdef DEBUG(reverting) should be fine, cause it will not be written to a config file anyway, as long as it remains on the default value.. and it is quite unlikely anyone will ever change it.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Debug build crashes before loading

Post by jK »

Still it shows up in --list-configs & maybe in a future lua config system.
The real questions is why isn't DEBUG defined in VS debug build?
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Debug build crashes before loading

Post by hoijui »

ahh right...
and indeed.. strange!
an other thing that would likely be fixed if we would use the CMake generated VS projects.
Last edited by hoijui on 10 Oct 2011, 10:05, edited 1 time in total.
zerver
Spring Developer
Posts: 1358
Joined: 16 Dec 2006, 20:59

Re: Debug build crashes before loading

Post by zerver »

jK wrote:The real questions is why isn't DEBUG defined in VS debug build?
DEBUG is defined, but it was missing before (added 22/9).
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Debug build crashes before loading

Post by Beherith »

jK wrote:

Code: Select all

git stash
git pull
git rebase (needed for unpushed commits)
git stash pop
git mergetool (in case of merge problems)
In retrospect, this did nothing to my repo, it didnt update to latest :(
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Debug build crashes before loading

Post by jK »

then use `git fetch` instead of `git pull` and check error message of it.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Debug build crashes before loading

Post by Beherith »

I have since pushed commits to this repo to github :( But i'll try it.

Edit: scratch that, im being retarded, git fetch obviously does nothing cause the repo is now pointed to https://github.com/Beherith/spring.

Edit2: Nvm, its solved now, on origin develop :D Thanks BrainDamage!
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Debug build crashes before loading

Post by jK »

https://github.com/bricoleurs/bricolage ... g-with-Git end of page

so the following should work

Code: Select all

git remote add main git://github.com/spring/spring.git
git fetch main
(+ git stash and co)
Last edited by jK on 14 Oct 2011, 12:32, edited 1 time in total.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Debug build crashes before loading

Post by Beherith »

Thanks jK, solved now :D
Post Reply

Return to “Engine”