Hi Soren,

thanks a lot for your assistance, the proposed switch helped and the crash
is gone. Cool!

BTW, compilation on windows outputs about a million of warnings, mostly
relevant to v8.h file. Some of them are mentioned in issue #482, some of
them not. I am not sure how severe these are, it is just my small
observation :)


Ondrej


2009/10/23 Søren Gjesse <[email protected]>

> With your SCons file I could generate the crash on Visual Studio 2005. I
> changed the line
>
>   CCFLAGS = ["-Wall", "-O3"],
>
> to
>
>   CCFLAGS = ["/EHsc"],
>
> and now it works file. Take a look at
> http://msdn.microsoft.com/en-us/library/1deeycx5(VS.80).aspx<http://msdn.microsoft.com/en-us/library/1deeycx5%28VS.80%29.aspx>
>  for
> informatoin on this option that controls handling of objects which goes out
> of scope when an exception is thrown. Note that when compiling on Windows
> the flags needs to be specified for the Visual C++ compiler. SCons cannot
> translate g++ flags to equivalent VC ones. You will probably need something
> like tils for MSVC.
>
>   CCFLAGS = ["/W3", "/O2", "/EHsc"],
>
> This actually reveals some C4251 compiler warnings related to using V8 in a
> DLL, that I will take a look at and have filed issue 
> 482<http://code.google.com/p/v8/issues/detail?id=482>tracking that.
>
> Regards,
> Søren
>
> On Fri, Oct 23, 2009 at 08:27, Ondřej Žára <[email protected]> wrote:
>
>> Hi Soren,
>>
>> some further information:
>>
>> - the code is compiled against recent V8 trunk revision,
>> - using the MS debugger, I traced the crash to this code (factory.cc):
>>
>> Handle<Struct> Factory::NewStruct(InstanceType type) {
>>   CALL_HEAP_FUNCTION(Heap::AllocateStruct(type), Struct);
>> }
>>
>>
>> Additional info provided by the MS Debugger folows:
>>
>>
>> MODULE_NAME: v8
>> FAULTING_MODULE: 7c900000 ntdll
>> DEBUG_FLR_IMAGE_TIMESTAMP:  4adef891
>> ERROR_CODE: (NTSTATUS) 0xc0000005 - Instrukce na adrese 0x%08lx odkazovala
>> na adresu pam
>> EXCEPTION_CODE: (NTSTATUS) 0xc0000005 - Instrukce na adrese 0x%08lx
>> odkazovala na adresu pam
>> EXCEPTION_PARAMETER1:  00000001
>> EXCEPTION_PARAMETER2:  00000000
>> WRITE_ADDRESS:  00000000
>>
>> FOLLOWUP_IP:
>> v8!v8::internal::Factory::NewStruct+30 [z:\v8\src\factory.cc @ 150]
>> 10026420 8938            mov     dword ptr [eax],edi
>>
>> FAULTING_THREAD:  000004e0
>> BUGCHECK_STR:
>> APPLICATION_FAULT_NULL_POINTER_READ_NULL_POINTER_WRITE_WRONG_SYMBOLS
>> PRIMARY_PROBLEM_CLASS:  NULL_POINTER_READ
>> DEFAULT_BUCKET_ID:  NULL_POINTER_READ
>> LAST_CONTROL_TRANSFER:  from 10007af3 to 10026420
>>
>> STACK_TEXT:
>> 0012ff30 10007af3 7ffdf000 0012ff60 2b5e1080
>> v8!v8::internal::Factory::NewStruct+0x30 [z:\v8\src\factory.cc @ 150]
>> 0012ff40 10007a3e 0012ff60 00000000 00000000
>> v8!v8::ObjectTemplate::New+0xa3 [z:\v8\src\api.cc @ 882]
>> 0012ff50 004011c3 0012ff60 00405780 2b1ed2b0
>> v8!v8::ObjectTemplate::New+0xe [z:\v8\src\api.cc @ 868]
>> WARNING: Stack unwind information not available. Following frames may be
>> wrong.
>> 0012ff78 00402656 00000001 003d3170 003d3188 crash+0x11c3
>> 0012ffc0 7c817077 00000012 00000000 7ffdf000 crash+0x2656
>> 0012fff0 00000000 004026ad 00000000 00000000
>> kernel32!RegisterWaitForInputIdle+0x49
>>
>> STACK_COMMAND:  ~0s; .ecxr ; kb
>>
>>
>>
>>
>>
>> Ondrej
>>
>>
>>
>>
>>
>> 2009/10/23 Ondřej Žára <[email protected]>
>>
>> Hi Soren,
>>>
>>> thanks a lot for your response. I have attached all files relevant to my
>>> issue:
>>>  - source code,
>>>  - SConstruct file,
>>>  - DrWatson logfile,
>>>  - user.dmp file (two last files are created in DrWatson directory after
>>> the crash).
>>>
>>> Unfortunately, I have no experience with the debugging workflow on
>>> Windows, so I hope these are sufficient. My compiler is MS VC++ Express
>>> 2008.
>>>
>>>
>>> Thanks for assistance,
>>> Ondrej
>>>
>>>
>>>
>>>
>>> 2009/10/22 Søren Gjesse <[email protected]>
>>>
>>> I have just tried to create a Visual Studio project like the
>>>> v8_sample_shell containing your code (actually just putting your code in
>>>> shell.cc) and added the option /EHsc. It seems to run fine for me in both
>>>> Debug and Release build. I am using used Visual Studio 2005. I also tried 
>>>> to
>>>> add option /EHsc to the v8 and v8_base project and that also seemed to work
>>>> fine. If a turn on break on C++ exceptions in the Visual Studio debugger I
>>>> also get a break when the C++ exception is thrown. Could you perhaps post
>>>> some more information on the build options used to make the crash happen?
>>>>
>>>> Regards,
>>>> Søren
>>>>
>>>> On Thu, Oct 22, 2009 at 08:14, ondras <[email protected]> wrote:
>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> I run into a very strange runtime error in my v8 application. I
>>>>> managed to track down the issue and I am including a minimal working
>>>>> sample. This code must be compiled with MSVC and then executed.
>>>>>
>>>>> I am possibly doing something very wrong here (although GCC way works
>>>>> ok), but I am unable to find out what is the exact cause of the crash.
>>>>> The error happens when the line with "TEST" ObjectTemplate gets
>>>>> executed.
>>>>>
>>>>> Note that any of the following makes the issue disappear:
>>>>>  - remove any of the HandleScopes;
>>>>>  - remove the "throw" portion of JS code in execute2();
>>>>>  - do not pass the v8::Object::New() to execute2()
>>>>>
>>>>>
>>>>> Thanks a lot for any assistance,
>>>>> Ondrej Zara
>>>>> (code follows)
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> #include <string>
>>>>> #include <v8.h>
>>>>>
>>>>> void execute2(v8::Handle<v8::Object> someObject) {
>>>>>        v8::HandleScope handle_scope;
>>>>>        v8::TryCatch tc;
>>>>>
>>>>>        v8::Script::New(v8::String::New("throw 1;"))->Run();
>>>>>
>>>>>        if (tc.HasCaught()) { throw std::string("exception"); }
>>>>> }
>>>>>
>>>>>  void execute1() {
>>>>>        v8::HandleScope handle_scope;
>>>>>        try {
>>>>>                execute2(v8::Object::New());
>>>>>        } catch (std::string e) {
>>>>>        }
>>>>> }
>>>>>
>>>>> void create_context() {
>>>>>        v8::HandleScope handle_scope;
>>>>>        v8::Context::New(NULL, v8::ObjectTemplate::New())->Enter();
>>>>> }
>>>>>
>>>>> int main(int argc, char ** argv) {
>>>>>        v8::HandleScope handle_scope;
>>>>>
>>>>>        create_context();
>>>>>        execute1();
>>>>>        v8::Handle<v8::ObjectTemplate> TEST = v8::ObjectTemplate::New();
>>>>>
>>>>>        return 0;
>>>>> }
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to