Status: New
Owner: ----

New issue 2338 by alysson...@gmail.com: V8 engine embedded in a DLL doesn't work when using the V8/javascript debug system
http://code.google.com/p/v8/issues/detail?id=2338

consider the following code:

---------------------
HandleScope handle_scope;
Persistent<Context> context = Context::New();
Context::Scope scope(context);

Debug::EnableAgent("sometest", 9696, true);

Handle<Script> scr = Script::Compile(String::New("'teste' + 'hello'"));
scr->Run();

--------------------

it works fine if it's built as an "exe" file, but if built as a dll/dynamic library it will fail on the line "Script::Compile(....." throwing an "Floating-point division by zero" exception with the following callstack:

------------ CALL STACK --------------------
v8facade.dll!v8::internal::Parser::ParseBinaryExpression(int prec=10, bool accept_IN=true, bool * ok=0x0018ef1b) Line 3240 + 0x9 bytes C++ v8facade.dll!v8::internal::Parser::ParseBinaryExpression(int prec=4, bool accept_IN=true, bool * ok=0x0018ef1b) Line 3221 + 0x18 bytes C++ v8facade.dll!v8::internal::Parser::ParseConditionalExpression(bool accept_IN=true, bool * ok=0x0018ef1b) Line 3188 + 0x13 bytes C++ v8facade.dll!v8::internal::Parser::ParseAssignmentExpression(bool accept_IN=true, bool * ok=0x0018ef1b) Line 3115 + 0x11 bytes C++ v8facade.dll!v8::internal::Parser::ParseExpression(bool accept_IN=true, bool * ok=0x0018ef1b) Line 3096 + 0x11 bytes C++ v8facade.dll!v8::internal::Parser::ParsePrimaryExpression(bool * ok=0x0018ef1b) Line 3763 + 0xe bytes C++ v8facade.dll!v8::internal::Parser::ParseMemberWithNewPrefixesExpression(v8::internal::PositionStack * stack=0x00000000, bool * ok=0x0018ef1b) Line 3571 + 0xc bytes C++ v8facade.dll!v8::internal::Parser::ParseMemberExpression(bool * ok=0x0018ef1b) Line 3542 C++ v8facade.dll!v8::internal::Parser::ParseLeftHandSideExpression(bool * ok=0x0018ef1b) Line 3434 + 0xc bytes C++ v8facade.dll!v8::internal::Parser::ParsePostfixExpression(bool * ok=0x0018ef1b) Line 3395 + 0xc bytes C++ v8facade.dll!v8::internal::Parser::ParseUnaryExpression(bool * ok=0x0018ef1b) Line 3388 C++ v8facade.dll!v8::internal::Parser::ParseBinaryExpression(int prec=6, bool accept_IN=true, bool * ok=0x0018ef1b) Line 3215 + 0xc bytes C++ v8facade.dll!v8::internal::Parser::ParseBinaryExpression(int prec=4, bool accept_IN=true, bool * ok=0x0018ef1b) Line 3221 + 0x18 bytes C++ v8facade.dll!v8::internal::Parser::ParseConditionalExpression(bool accept_IN=true, bool * ok=0x0018ef1b) Line 3188 + 0x13 bytes C++ v8facade.dll!v8::internal::Parser::ParseAssignmentExpression(bool accept_IN=true, bool * ok=0x0018ef1b) Line 3115 + 0x11 bytes C++ v8facade.dll!v8::internal::Parser::ParseExpression(bool accept_IN=true, bool * ok=0x0018ef1b) Line 3096 + 0x11 bytes C++ v8facade.dll!v8::internal::Parser::ParsePrimaryExpression(bool * ok=0x0018ef1b) Line 3763 + 0xe bytes C++ v8facade.dll!v8::internal::Parser::ParseMemberWithNewPrefixesExpression(v8::internal::PositionStack * stack=0x00000000, bool * ok=0x0018ef1b) Line 3571 + 0xc bytes C++ v8facade.dll!v8::internal::Parser::ParseMemberExpression(bool * ok=0x0018ef1b) Line 3542 C++ v8facade.dll!v8::internal::Parser::ParseLeftHandSideExpression(bool * ok=0x0018ef1b) Line 3434 + 0xc bytes C++ v8facade.dll!v8::internal::Parser::ParsePostfixExpression(bool * ok=0x0018ef1b) Line 3395 + 0xc bytes C++ v8facade.dll!v8::internal::Parser::ParseUnaryExpression(bool * ok=0x0018ef1b) Line 3388 C++ v8facade.dll!v8::internal::Parser::ParseBinaryExpression(int prec=5, bool accept_IN=true, bool * ok=0x0018ef1b) Line 3215 + 0xc bytes C++ v8facade.dll!v8::internal::Parser::ParseBinaryExpression(int prec=4, bool accept_IN=true, bool * ok=0x0018ef1b) Line 3221 + 0x18 bytes C++ v8facade.dll!v8::internal::Parser::ParseConditionalExpression(bool accept_IN=true, bool * ok=0x0018ef1b) Line 3188 + 0x13 bytes C++ v8facade.dll!v8::internal::Parser::ParseAssignmentExpression(bool accept_IN=true, bool * ok=0x0018ef1b) Line 3115 + 0x11 bytes C++ v8facade.dll!v8::internal::Parser::ParseExpression(bool accept_IN=true, bool * ok=0x0018ef1b) Line 3096 + 0x11 bytes C++ v8facade.dll!v8::internal::Parser::ParsePrimaryExpression(bool * ok=0x0018ef1b) Line 3763 + 0xe bytes C++ v8facade.dll!v8::internal::Parser::ParseMemberWithNewPrefixesExpression(v8::internal::PositionStack * stack=0x00000000, bool * ok=0x0018ef1b) Line 3571 + 0xc bytes C++ v8facade.dll!v8::internal::Parser::ParseMemberExpression(bool * ok=0x0018ef1b) Line 3542 C++ v8facade.dll!v8::internal::Parser::ParseLeftHandSideExpression(bool * ok=0x0018ef1b) Line 3434 + 0xc bytes C++ v8facade.dll!v8::internal::Parser::ParsePostfixExpression(bool * ok=0x0018ef1b) Line 3395 + 0xc bytes C++ v8facade.dll!v8::internal::Parser::ParseUnaryExpression(bool * ok=0x0018ef1b) Line 3388 C++ v8facade.dll!v8::internal::Parser::ParseUnaryExpression(bool * ok=0x0018ef1b) Line 3323 + 0xc bytes C++ v8facade.dll!v8::internal::Parser::ParseBinaryExpression(int prec=4, bool accept_IN=true, bool * ok=0x0018ef1b) Line 3215 + 0xc bytes C++ v8facade.dll!v8::internal::Parser::ParseConditionalExpression(bool accept_IN=true, bool * ok=0x0018ef1b) Line 3188 + 0x13 bytes C++ v8facade.dll!v8::internal::Parser::ParseAssignmentExpression(bool accept_IN=true, bool * ok=0x0018ef1b) Line 3115 + 0x11 bytes C++ v8facade.dll!v8::internal::Parser::ParseExpression(bool accept_IN=true, bool * ok=0x0018ef1b) Line 3096 + 0x11 bytes C++ v8facade.dll!v8::internal::Parser::ParseIfStatement(v8::internal::ZoneList<v8::internal::Handle<v8::internal::String>
* labels=0x00000000, bool * ok=0x0018ef1b)  Line 2518 + 0xe bytes       C++
v8facade.dll!v8::internal::Parser::ParseStatement(v8::internal::ZoneList<v8::internal::Handle<v8::internal::String>
* labels=0x00000000, bool * ok=0x0018ef1b)  Line 1674 + 0x10 bytes      C++
v8facade.dll!v8::internal::Parser::ParseModuleElement(v8::internal::ZoneList<v8::internal::Handle<v8::internal::String>
* labels=0x00000000, bool * ok=0x0018ef1b)  Line 1254 + 0x10 bytes      C++
v8facade.dll!v8::internal::Parser::ParseSourceElements(v8::internal::ZoneList<v8::internal::Statement *> * processor=0x046c7054, int end_token=6, bool is_eval=false, bool * ok=0x0018ef1b) Line 1160 + 0x11 bytes C++ v8facade.dll!v8::internal::Parser::ParseFunctionLiteral(v8::internal::Handle<v8::internal::String> function_name={...}, bool name_is_strict_reserved=false, int function_token_position=36445, v8::internal::FunctionLiteral::Type type=DECLARATION, bool * ok=0x0018ef1b) Line 4670 + 0x17 bytes C++ v8facade.dll!v8::internal::Parser::ParseFunctionDeclaration(v8::internal::ZoneList<v8::internal::Handle<v8::internal::String>
* names=0x00000000, bool * ok=0x0018ef1b)  Line 2009 + 0x1b bytes       C++
v8facade.dll!v8::internal::Parser::ParseModuleElement(v8::internal::ZoneList<v8::internal::Handle<v8::internal::String>
* labels=0x00000000, bool * ok=0x0018ef1b)  Line 1245 + 0xe bytes       C++
v8facade.dll!v8::internal::Parser::ParseSourceElements(v8::internal::ZoneList<v8::internal::Statement *> * processor=0x046572bc, int end_token=0, bool is_eval=false, bool * ok=0x0018ef1b) Line 1160 + 0x11 bytes C++ v8facade.dll!v8::internal::Parser::DoParseProgram(v8::internal::CompilationInfo * info=0x0018f720, v8::internal::Handle<v8::internal::String> source={...}, v8::internal::ZoneScope * zone_scope=0x0018f3f4) Line 646 C++
v8facade.dll!v8::internal::Parser::ParseProgram()  Line 590 + 0x1f bytes        
C++
v8facade.dll!v8::internal::ParserApi::Parse(v8::internal::CompilationInfo * info=0x0018f720, int parsing_flags=12) Line 6106 + 0xb bytes C++ v8facade.dll!v8::internal::MakeFunctionInfo(v8::internal::CompilationInfo * info=0x0018f720) Line 467 + 0xd bytes C++ v8facade.dll!v8::internal::Compiler::Compile(v8::internal::Handle<v8::internal::String> source={...}, v8::internal::Handle<v8::internal::Object> script_name={...}, int line_offset=0, int column_offset=0, v8::internal::Handle<v8::internal::Context> context={...}, v8::Extension * extension=0x00000000, v8::internal::ScriptDataImpl * pre_data=0x00000000, v8::internal::Handle<v8::internal::Object> script_data={...}, v8::internal::NativesFlag natives=NATIVES_CODE) Line 604 + 0x13 bytes C++ v8facade.dll!v8::internal::Debug::CompileDebuggerScript(int index=1) Line 758 + 0x3a bytes C++
v8facade.dll!v8::internal::Debug::Load()  Line 845 + 0x13 bytes C++
v8facade.dll!v8::internal::EnterDebugger::EnterDebugger() Line 3412 + 0x8 bytes C++ v8facade.dll!v8::internal::Debugger::OnBeforeCompile(v8::internal::Handle<v8::internal::Script> script={...}) Line 2738 C++ v8facade.dll!v8::internal::MakeFunctionInfo(v8::internal::CompilationInfo * info=0x0018fb9c) Line 461 C++ v8facade.dll!v8::internal::Compiler::Compile(v8::internal::Handle<v8::internal::String> source={...}, v8::internal::Handle<v8::internal::Object> script_name={...}, int line_offset=0, int column_offset=0, v8::internal::Handle<v8::internal::Context> context={...}, v8::Extension * extension=0x00000000, v8::internal::ScriptDataImpl * pre_data=0x00000000, v8::internal::Handle<v8::internal::Object> script_data={...}, v8::internal::NativesFlag natives=NOT_NATIVES_CODE) Line 604 + 0x13 bytes C++ v8facade.dll!v8::Script::New(v8::Handle<v8::String> source={...}, v8::ScriptOrigin * origin=0x00000000, v8::ScriptData * pre_data=0x00000000, v8::Handle<v8::String> script_data={...}) Line 1544 + 0x51 bytes C++ v8facade.dll!v8::Script::Compile(v8::Handle<v8::String> source={...}, v8::ScriptOrigin * origin=0x00000000, v8::ScriptData * pre_data=0x00000000, v8::Handle<v8::String> script_data={...}) Line 1569 + 0x19 bytes C++
v8facade.dll!V8FacadeMakeInnerTests()  Line 2606 + 0x43 bytes   C++
Project1.exe!0051765c()
------------------------------------------------------- end of CALLSTACK --------------


Removing the line "Debug::EnableAgent("sometest", 9696, true);" or calling with the last parameter set to false, it works. I am building the DLL with the Snapshot feature. If built without the Snapshot feature, nothing works, no script compiles even without the javascript-debug.
I am using Visual Studio 2008 express

Apparently the fail occurs during the runtime-build of some inner javascript code that supports debug feature.



--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev

Reply via email to