Jump to content
  • Advertisement
Sign in to follow this  

Debug information invalidates the bytecode

This topic is 1872 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

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.

Edited by TheAtom

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

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.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!