This worked :

printf("Callstack:\n%s", 
emscripten_run_script_string("Module.stackTrace();"));

Why do I have to print in console using a C++ printf? I was never able to 
get something to print in the console using EM_ASM or emscripten_run_script.

On Tuesday, November 3, 2015 at 11:24:41 AM UTC-5, Robert Goulet wrote:
>
> Actually, I tried with Module.stackTrace() and that didn't work either.
>
> On Tuesday, November 3, 2015 at 10:45:43 AM UTC-5, Robert Goulet wrote:
>>
>> I tried calling stackTrace and it didn't work. Is there special build 
>> flags we need to pass to enable it?
>>
>> Here is what I tried:
>>
>> EM_ASM(
>>     console.log('Callstack:' + stackTrace());
>> );
>>
>> When I call C++ printf I see stuff in the console. But using JS 
>> console.log never prints anything. Why?
>>
>>
>> On Wednesday, October 21, 2015 at 4:58:29 PM UTC-4, Alon Zakai wrote:
>>>
>>> Yeah, emscripten has jsStackTrace() which returns the JS stack, and 
>>> stackTrace() which does the same with c++ names demangled.
>>>
>>> On Wed, Oct 21, 2015 at 1:52 PM, Brion Vibber <[email protected]> wrote:
>>>
>>>> You should be able to get a call stack by throwing a JS exception; if 
>>>> using sufficient debug or profiling options in your build you should get 
>>>> useful function names out of that, which is a huge help even if the full 
>>>> debugger is not attached.
>>>>
>>>> Should be pretty easy to attach a JS library function to do that.
>>>>
>>>> -- brion
>>>>
>>>> On Wed, Oct 21, 2015 at 1:48 PM, Robert Goulet <[email protected]> 
>>>> wrote:
>>>>
>>>>> Is there any easier way to trace down code, even without checked 
>>>>> variables content, just to see the callstack?
>>>>>
>>>>> On Wednesday, October 21, 2015 at 3:58:55 PM UTC-4, Alon Zakai wrote:
>>>>>>
>>>>>> In my experience very large projects are indeed hard to get running 
>>>>>> in browser debuggers. They just haven't been optimized for that size 
>>>>>> code 
>>>>>> yet, I think.
>>>>>>
>>>>>> I do most of my debugging using dump(), which writes to stdout in the 
>>>>>> console firefox was started from. (You need to set 
>>>>>> browser.dom.window.dump.enabled in about:config for that to work.) Or 
>>>>>> alert() when I want things to be paused. Or just console.log() when the 
>>>>>> amount of output is small.
>>>>>>
>>>>>> On Wed, Oct 21, 2015 at 11:02 AM, Robert Goulet <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>> I'm trying to setup debugging in-browser, but it doesn't work for 
>>>>>>> me, and I am wondering if it's just related to the size of my project? 
>>>>>>> Does 
>>>>>>> anyone successfully used breakpoints in code built with -g4 in Firefox 
>>>>>>> Nightly? Everytime I add a breakpoint, it just freeze Firefox and I 
>>>>>>> have to 
>>>>>>> kill it. Please share your experience and tips. Thanks!
>>>>>>>
>>>>>>> -- 
>>>>>>> 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 [email protected].
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>>> -- 
>>>>> 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 [email protected].
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>> -- 
>>>> 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 [email protected].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to