Jump to content
  • Advertisement
Sign in to follow this  
Desdemona

Debug problems

This topic is 5053 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

v1.9.0 Until recently, I've just been using a retail build of the angelscript.lib. My game seemed to be working great. But I just tried making a debug compile of everything, and now my program cant even run... What I am wondering is what sort of things might be causing this assert to occur:
Assertion failed: tempVariables.GetLength() == 0, file d:\co
de\angelscript_1_9_0\source\as_compiler.cpp, line 364

// This is where AS was at the time:
Lands.exe!_NMSG_WRITE(int rterrnum=10)  Line 195	C
Lands.exe!abort()  Line 44 + 0x7	C
Lands.exe!_assert(const char * expr=0x0055e928, const char * filename=0x0055e870, unsigned int lineno=364)  Line 306	C
Lands.exe!asCCompiler::CompileStatementBlock(asCScriptNode * block=0x01211698, bool ownVariableScope=false, bool * hasReturn=0x0012f1e7, asCByteCode * bc=0x0012f1d4)  Line 364 + 0x27	C++
Lands.exe!asCCompiler::CompileFunction(asCBuilder * builder=0x01065a80, asCScriptCode * script=0x01070b98, asCScriptNode * func=0x0120d090)  Line 208	C++
Lands.exe!asCBuilder::CompileFunctions()  Line 245 + 0x38	C++
Lands.exe!asCBuilder::Build()  Line 119	C++
Lands.exe!asCModule::Build(asIOutputStream * out=0x00570f50)  Line 98 + 0xb	C++
Lands.exe!asCScriptEngine::Build(const char * module=0x00000000, asIOutputStream * out=0x00570f50)  Line 188	C++
Lands.exe!CSScripting::InitAngelScript()  Line 196 + 0x1c	C++
Lands.exe!CSScripting::Reload()  Line 76	C++
Lands.exe!Refresh()  Line 146	C++
Lands.exe!main()  Line 83	C++
Lands.exe!mainCRTStartup()  Line 259 + 0x19	C
kernel32.dll!7c816d4f() 	
ntdll.dll!7c915b4f() 	
kernel32.dll!7c8399f3() 	

Share this post


Link to post
Share on other sites
Advertisement
You've discovered a situation where the compiler allocates a temporary variable to hold an object but doesn't release again as it should. This may make the script function use more stack memory than it really needs, but otherwise the release version should not have any problem.

Would it be possible for you to narrow down your script in order to find what kind of statement it is that causes the assert failure? I would very much like to fix this bug, but without an example that reproduces it I would only be fumbling in the dark.

Oh, if you have a need to use the debug version, but can't wait for the bug fix you could just comment out this assert statement.

Share this post


Link to post
Share on other sites
Quote:
Original post by Desdemona
v1.9.0

What I am wondering is what sort of things might be causing this assert to occur:

*** Source Snippet Removed ***


I encountered the same when I used ternary '?' operator with bstr-s (see my another post).

Cheers,
RCL

Share this post


Link to post
Share on other sites
Ok, thanks for the information. I applied the patch to the CompileCondition method, but asserts were still failing. I started to get the following assert: "Assertion failed: n < destructors.GetLength(), file d:\code\angelscript_1_9_0\source\as_bytecode.cpp, line 316" while in GenerateExceptionHandler.

I had a little over a dozen script files, so I stripped it down to the bare minimum to run and went from there. It turns out the problem was with the ?: operator after all.

This does not work:


void toggle_option(Data* pPlayer, string mode, string enable, string disable)
{
bool cur = pPlayer->TestFlag(mode, "true");

pPlayer->SetAttributeBase(mode, (cur ? "false" : "true"));
sendto(pPlayer, "\x1B[0;37m" + (cur ? disable : enable) + "\r\n");
}



I changed it so it didn't use the ?: operator and it worked:

void toggle_option(Data* pPlayer, string mode, string enable, string disable)
{
if (pPlayer->TestFlag(mode, "true"))
{
pPlayer->SetAttributeBase(mode, "false");
sendto(pPlayer, "\x1B[0;37m" + disable + "\r\n");
}
else
{
pPlayer->SetAttributeBase(mode, "true");
sendto(pPlayer, "\x1B[0;37m" + enable + "\r\n");
}
}


Share this post


Link to post
Share on other sites
I'm sorry for not fixing this one quickly. I didn't have time before now to look at the problem.

I've been able to reproduce the error in my test_framework and it looks like the problem really isn't with the ternary operator :? after all. At least not only with it.

The following test case also fails with the same assertion:


// AngelScript
string a;
void Test(string strA)
{
a = strA;
}


Hopefully I'll have the fix ready in a few hours.

Share this post


Link to post
Share on other sites
Actually, I'm not sure. I had a complete brain shutdown and testeded it without even installing WIP1. ;) For some reason, it worked when I tried it; odd. I just compiled my project /w WIP1 but it is failing to allocate the script engine at the moment. Strange...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!