[JS] Line numbers in errors

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[JS] Line numbers in errors

Michael Cann
First the question: Would it be possible to add line numbers to runtime errors for the JS target?

My understanding is (please correct me if wrong), runtime errors have stack tracing because they are pushed into a stack var at the start and end of a function block. We dont have line numbers is because they would have to be put in before every single equivilant JS line. And trace statements have line numbers because the compiler can statically insert the line number at the call point.

Am I right there?

The reason for my question is at the moment its quite painful to debug a problem in your JS code, particularly when you are using a library like Jeash. The chrome or firebug debug tools are good but its pretty tricky to understand whats going on when there are thousands of lines of code in one file and the code generated is pretty cryptic compared to your haXe source.

The perfect solution would be is that JS is just considered a blackbox like the Flash byte code is. When you are debugging your program you arent stepping over byte code but your source that represents it.

I dont know enough about writing languages to know if its possible but would it be possible to output more information into the generated code (when using -debug) or even generate another file "MyApplication_debug.js" which could contain some more debug info tooling could use?

Any thoughts?

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [JS] Line numbers in errors

Bruno Garcia-2
On 10/15/2011 01:48 PM, Michael Cann wrote:
> First the question: Would it be possible to add line numbers to
> runtime errors for the JS target?

Thanks to tons of people using Coffeescript, support for this is coming
to Firefox and Webkit:

https://wiki.mozilla.org/DevTools/Features/SourceMap
https://bugs.webkit.org/show_bug.cgi?id=63940

We could implement haXe source maps on top of this once it's available.
Actually, there's already a Firebug extension that provides source map
debugging if anyone is feeling adventurous:
http://code.google.com/closure/compiler/docs/inspector.html

Bruno

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [JS] Line numbers in errors

Michael Cann
Oh great! Ill take a longer look at these soon.

On 17 October 2011 03:39, Bruno Garcia <[hidden email]> wrote:
On 10/15/2011 01:48 PM, Michael Cann wrote:
First the question: Would it be possible to add line numbers to runtime errors for the JS target?

Thanks to tons of people using Coffeescript, support for this is coming to Firefox and Webkit:

https://wiki.mozilla.org/DevTools/Features/SourceMap
https://bugs.webkit.org/show_bug.cgi?id=63940

We could implement haXe source maps on top of this once it's available. Actually, there's already a Firebug extension that provides source map debugging if anyone is feeling adventurous: http://code.google.com/closure/compiler/docs/inspector.html

Bruno

--
haXe - an open source web programming language
http://haxe.org



--
Mike Cann
http://www.mikecann.co.uk/


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [JS] Line numbers in errors

Nicolas Cannasse
In reply to this post by Bruno Garcia-2
Le 17/10/2011 04:39, Bruno Garcia a écrit :

> On 10/15/2011 01:48 PM, Michael Cann wrote:
>> First the question: Would it be possible to add line numbers to
>> runtime errors for the JS target?
>
> Thanks to tons of people using Coffeescript, support for this is coming
> to Firefox and Webkit:
>
> https://wiki.mozilla.org/DevTools/Features/SourceMap
> https://bugs.webkit.org/show_bug.cgi?id=63940
>
> We could implement haXe source maps on top of this once it's available.
> Actually, there's already a Firebug extension that provides source map
> debugging if anyone is feeling adventurous:
> http://code.google.com/closure/compiler/docs/inspector.html

Really looking forward to it. As soon as a browser get proper support
for it I'll make sure to create the source map output for haXe.

Best,
Nicolas

--
haXe - an open source web programming language
http://haxe.org