Skip to main content
GameDev.net gamedev.net
🔒 Locked

Debug information invalidates the bytecode

Started by TheAtom Apr 3, 2013 at 2:11 AM 3 replies 1.8k views
Original Post
TheAtom
TheAtom

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.

WitchLord
WitchLord
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 - <a href="http://www.angelcode.com/tower" rel
WitchLord
WitchLord

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 - <a href="http://www.angelcode.com/tower" rel
TheAtom
TheAtom

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.

WitchLord
WitchLord
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 - <a href="http://www.angelcode.com/tower" rel

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.