Re: Strange behaviour on stepping.

"Mike Moening" <[email protected]>
Newsgroups gmane.comp.mozilla.devel.jsdebugger
Organization Retail Technology Solutions Inc.
Message-ID <[email protected]>
I had the same problem a while back....
See bug:  https://bugzilla.mozilla.org/show_bug.cgi?id=313922

"Dassburger" <[email protected]> wrote in message
news:[email protected]...
>
> Dassburger wrote:
> > Randy D. Smith wrote:
> > > Isn't this all just the "normal expected behavior" as documented in <
> > > http://article.gmane.org/gmane.comp.mozilla.devel.jsdebugger/688
> > > >? When I was trying to come up to speed on Venkman, I read through
that
> > > newsgroup and this thread brought to mind the "What do people use
Venkman
> > > for?" thread. I suggest reading through it to see that the two pass
approach
> > > is "per the standard" according to the claims there.
> > > --
> > >      RDS
> >
> > Very interesting! It really seemed to me that this is somewhat related
> > with creation of variables. But another question arises - is there some
> > way to determine the state of the interpretator in a hook handler? I'm
> > starting to look for it, but it would be great if someone old,
> > long-white-bearded, and knowledgeful gave me some ideas. :-)
>
> The probem is solved! When compiling a script SpiderMonkey puts
> bytecode which creates global vars and sets them undefined value first.
> Then goes the actual bytecode. The problem is that initialization code
> has the same line numbers where vars are declared. JSD_GetClosestPC()
> looks through the bytecode and stops searching when instruction's line
> number is equal or greater than its argument. If argument is between
> two "var" declarations, it will return wrong PC. I propose to define)
> js_LineNumberToPC() as follows:
>
> jsbytecode *
> js_LineNumberToPC(JSScript *script, uintN target)
> {
>     ptrdiff_t offset;
>     uintN lineno;
>     jssrcnote *sn;
>     JSSrcNoteType type;
>     jsbytecode *pc_with_min_lineno_diff=0;   // dassb.
>     uintN min_lineno_diff = INT_MAX;         // dassb.
>
>     offset = 0;
>     lineno = script->lineno;
>     for (sn = SCRIPT_NOTES(script); !SN_IS_TERMINATOR(sn); sn =
> SN_NEXT(sn)) {
>         if (lineno >= target && (lineno - target) < min_lineno_diff) {
> //dassb.
>           min_lineno_diff = lineno - target;
> //dassb.
>           pc_with_min_lineno_diff = script->code + offset;
> //dassb.
>         }
> //dassb.
>         offset += SN_DELTA(sn);
>         type = (JSSrcNoteType) SN_TYPE(sn);
>         if (type == SRC_SETLINE) {
>             lineno = (uintN) js_GetSrcNoteOffset(sn, 0);
>         } else if (type == SRC_NEWLINE) {
>             lineno++;
>         }
>     }
>     return pc_with_min_lineno_diff;
> }
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.