Jump to content

  • Log In with Google      Sign In   
  • Create Account


- - - - -

Debug information invalidates the bytecode


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 TheAtom   Members   -  Reputation: 330

Like
0Likes
Like

Posted 02 April 2013 - 08:11 PM

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, 03 April 2013 - 08:53 PM.


Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3263

Like
0Likes
Like

Posted 03 April 2013 - 07:10 AM

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

#3 Andreas Jonsson   Moderators   -  Reputation: 3263

Like
0Likes
Like

Posted 03 April 2013 - 03:42 PM

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

#4 TheAtom   Members   -  Reputation: 330

Like
0Likes
Like

Posted 03 April 2013 - 08:46 PM

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.



#5 Andreas Jonsson   Moderators   -  Reputation: 3263

Like
0Likes
Like

Posted 04 April 2013 - 11:19 AM

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS