Advertisement

Debug information invalidates the bytecode

Started by April 03, 2013 02:11 AM
3 comments, last by WitchLord 11 years, 8 months ago

Edit: false alarm, see below

Tested on rev1602. Empty lines (or otherwise syntactically insignificant lines, such as comments) can make the saved bytecode unloadable due to some problems with source line debug information. The following fails to load from bytecode unless debug information has been stripped:
















funcdef void FUNC();
class T
{
    FUNC@ f;
}

void tmain()
{
    T t;
    @t.f = test;
    t.f();
}

void test()
{
}

LoadByteCode() returns asERROR. Removing any of the empty lines before the actual code begins seems to solve the issue.

That is odd. I'll investigate it. Thanks.

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

Advertisement

I couldn't reproduce the problem with the following test:

 
{
  engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
  engine->SetMessageCallback(asMETHOD(COutStream,Callback), &out, asCALL_THISCALL);
 
  mod = engine->GetModule(0, asGM_ALWAYS_CREATE);
  mod->AddScriptSection("Test",
    "\n"
    " \n"
    " \n"
    " \n"
    " \n"
    " \n"
    " \n"
    " \n"
    " \n"
    " \n"
    " \n"
    " \n"
    " \n"
    " \n"
    "funcdef void FUNC();\n"
    "class T\n"
    "{\n"
    "    FUNC@ f;\n"
    "}\n"
    "\n"
    "void tmain()\n"
    "{\n"
    "    T t;\n"
    "    @t.f = test;\n"
    "    t.f();\n"
    "}\n"
    "\n"
    "void test()\n"
    "{\n"
    "}\n");
  r = mod->Build();
  if( r < 0 )
    TEST_FAILED;
 
  CBytecodeStream stream(__FILE__"white");
  mod->SaveByteCode(&stream);
  engine->Release();
 
  engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
  engine->SetMessageCallback(asMETHOD(COutStream,Callback), &out, asCALL_THISCALL);
  mod = engine->GetModule("2", asGM_ALWAYS_CREATE);
  r = mod->LoadByteCode(&stream);
  if( r < 0 )
    TEST_FAILED;
 
  engine->Release();
}

Any idea what's missing to reproduce 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

The thing turned out to be a false alarm: it was Windows' CR/LF conversion mess up while loading the bytecode in our new test tool. Sorry to have bothered about this.

I understand. No problem. At least it wasn't a bug that was lurking in AngelScript. :)

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