Advertisement

Throwing exceptions, now in debug mode

Started by November 06, 2019 06:53 PM
1 comment, last by WitchLord 5 years ago

So I'm now using the version of Angelscript that is in vcpkg. It works great in release mode, but as soon as I get into debug mode I get some pretty wild effects. In particular, when I run the following script:

void main() {
    try { throw ("Hello"); }
    catch { Log ("world"); }

}

In release mode this works fine: it logs "world". But in debug mode the exception escapes the engine entirely (Execute() does not return asEXECUTION_EXCEPTION), ending up in my catch-all exception handler instead. Afterwards the engine appears to believe that the script has terminated; if I ask it to abort the script I get "Failed in call to function 'Execute' (Code: asCONTEXT_NOT_PREPARED, -4)".

I don't remember seeing this problem when I was compiling angelscript myself, so it could be something specific to the version in vcpkg, or the way it is compiled. Uhm, any idea what could be going wrong?

I'm not sure what version is in vcpkg, or what options for configurations whoever maintains this may have made, but as the first step I would debug the code by setting a breakpoint in the ScriptThrow function and then see what is happening with the exception.

ScriptThrow shouldn't throw a C++ exception so the fact that you end up in the catch-all exception handler sounds like there might be a null-pointer access somewhere.

If you can provide some more details I might be able to pinpoint the problem.

 

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement