Hi John,

Thanks for the response, it contains a lot of useful information.

I should provide some background on my question:

I don't know if you've seen (i've posted on this group a couple of
days ago), i'm building an extension for extracting web UI (user
interface) controls (http://www.fesb.hr/~jomaras/?id=apps). It's still
in the early stage, but its progressing bit by bit..

One of the things that this extension does is extracting executed js
lines - this is useless when extracting something that has been
mimified, so i'm searching for a way to extract only expressions that
have been executed (so this "project" with debugging would be just a
test application). The end goal is to keep only expressions that
either directly (this is easy) or indirectly (i have to track
dependencies from the direct DOM modifying expressions, not so easy..)
modify the DOM of the UI control. A sort of "dead code removal" from
the web UI control perspective (it's a small research project).

On 8 ruj, 17:07, John J Barton <[email protected]> wrote:
> On Sep 7, 11:23 pm, jomaras <[email protected]> wrote:
>
> > Hi all,
>
> > This is more a theoretical question: What do you think, is it possible
> > to implement "break on expression", e.g.
>
> > 1: if(a == 0) { func();}
>
> > So that, for example, i can choose the function call expression, and
> > then the debugger breaks not when it reaches the if statement (as it
> > normally would), but when it reaches the function call.
>
> The 'jsd' layer in Firefox platform provides for mapping line numbers
> to program counters and vice versa. Firebug uses this facility to
> implement breakpoints and single stepping. jsd does not support column
> or expression level information.

I haven't studied that part of Firebug, but i'll definitely do it,
maybe i find something useful.

> Mozilla has posted plans to develop 'jsdV2', which would support
> column level information.  As far as I know this work has not begun.
> Work on Firebug 1.7 aims to prepare for jsdV2.
>
> > This is just a simple example, but i think this could help, when for
> > example you have to inspect mimified code (or any other complex line).
>
> jsd supports "decompile", which renders a function without comments
> but in away that places most expressions on single lines.  This
> feature could be used to allow developers to break on expressions. We
> have part of the infrastructure to implement this, but its not trivial
> work. A further complication: the Script panel will be rewritten for
> Firebug 1.7. Gijs who works on venkman and thus knows jsd has
> expressed interest in working on decompile support.  Please let me
> know if you are interested in joining this effort.
>

I'm not sure if i'm good enough of a programmer, but this seems
interesting,
and i would like to contribute (how do i sign in?).

>
> > I'm asking this because i'm thinking of developing something like this
> > - the first idea is to have a searchable source code representation
> > (something like a simplified abstract syntax tree, so that i can
> > differentiate between code constructs - i already have this) and to
>
> Mozilla recently developed an abstract syntax tree 
> tool.https://bugzilla.mozilla.org/show_bug.cgi?id=533874
> We would like to leverage this once the support lands in 
> Firefox:https://bugzilla.mozilla.org/show_bug.cgi?id=590973

When i was doing executed lines extraction - i had to develop the same
thing (it's a Java program that i call from firefox, that parses
javascript code, builds a easily traversable model and outputs it as
JSON) -> so far it works (tested on jquery, prototype, mootools,..);
but it's great that it will be available directly in Firefox.

> This much could and should be done as a Firebug extension.
>
> > track the program counter (PC). I'm not sure about this PC part: can i
> > rely on PC tracking for identifying which expression in a line is
> > currently being executed?
>
> The PC advances in the interpreter in a very obvious way, except when
> it doesn't.

Do you have any more thoughts/info/links on this PC stuff - as i see
it this is the only information that can be used to somehow get to the
executed expressions. I've started to implement a little test plugin,
but it will be at least a week till i'll have some concrete data..

Thank you,

Josip

-- 
You received this message because you are subscribed to the Google Groups 
"Firebug" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/firebug?hl=en.

Reply via email to