I forgot to mention that before running grunt, you must've installed it
globally (npm install -g grunt-cli) and then run 'npm install' within the
'js' directory.

Arve

On Sat, Dec 13, 2014 at 12:56 AM, Arve Knudsen <arve.knud...@gmail.com>
wrote:

> Hi
>
> I've built ChucK with -g4 (thus producing a sourcemap) and -s SAFE_HEAP=3,
> and unsafe memory access is detected while executing ChucK. However, I am
> unable to debug the segfault and could use your help. I tell Chrome to halt
> on exceptions, and when exception halts on the segfault, a stack trace is
> produced that looks as follows:
>
>     invoke_iiiii (chuck.js:9199)
>     _executeCode (__tree:274)
>     asm._executeCode (chuck_emit.cpp:915)
>     ccallFunc (chuck.js:534)
>     (anonymous function) (whole.html:1)
>     jQuery.event.dispatch (jquery-1.10.2.js:5095)
>     jQuery.event.add.elemData.handle (jquery-1.10.2.js:4766)
>
> However, this stacktrace is of little use since it really doesn't make
> much sense. When I click on the asm._executeCode frame, the debugger enters
> the C++ function emit_engine_emit_do_while (line 915 of chuck.emit.cpp).
> Said line looks like this:
>
>     while( emit->code->stack_cont.size() && emit->code->stack_cont.back() )
>
> First of all, there's no correspondence betwen this function and the name
> of the stack frame ('asm._executeCode'). Second, when I click on the next
> frame, it resolves to the function __tree_balance_after_insert (of file
> '__tree'). This doesn't make much sense does it??
>
> When I let execution continue after the exception, a completely different
> looking traceback is printed to the console:
>
>     Uncaught abort() at Error
>         at jsStackTrace (
> http://localhost:8000/examples/basic/chuck.js:1049:13)
>         at stackTrace (
> http://localhost:8000/examples/basic/chuck.js:1066:22)
>         at abort (http://localhost:8000/examples/basic/chuck.js:561343:25)
>         at SAFE_HEAP_LOAD (
> http://localhost:8000/examples/basic/chuck.js:429:87)
>         at _strlen (
> http://localhost:8000/examples/basic/chuck.js:552513:43)
>         at Array.__ZNSt3__111char_traitsIcE6lengthEPKc
> [std::__1::char_traits<char>::length(char const*)] (
> http://localhost:8000/examples/basic/chuck.js:541966:7)
>         at Object.dynCall_ii (
> http://localhost:8000/examples/basic/chuck.js:553175:74)
>         at invoke_ii (
> http://localhost:8000/examples/basic/chuck.js:8873:32)
>         at
> Array.__ZN12_GLOBAL__N_19sporkCodeEP14Chuck_CompilerP8Chuck_VMPKcS5_
> [(anonymous namespace)::sporkCode(Chuck_Compiler*, Chuck_VM*, char const*,
> char const*)] (http://localhost:8000/examples/basic/chuck.js:256286:8)
>         at Object.dynCall_iiiii (
> http://localhost:8000/examples/basic/chuck.js:551097:77)
>
> How can I debug this exception?? Please help.
>
> If you like, you can reproduce by:
> 1. Check out https://github.com/aknuds1/chuck.git
> 2. cd chuck
> 3. pushd src && make -j8 CHUCK_DEBUG_LEVEL=4 CHUCK_EM_SAFEHEAP=3
> emscripten && popd && pushd js && grunt
> 4. python -m SimpleHTTPServer
> 5. Open http://localhost:8000/examples/basic/whole.html in Chrome (evt.
> some other browser)
> 6. Open the Developer Tools
> 7. Enable 'Pause on exceptions'
> 8. Click the 'Play' button
>
> Thanks,
> Arve
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to