On Monday, March 2, 2015 at 2:44:36 AM UTC+1, San wrote:
>
> Sebastian, you haven't addressed my core question, which doesn't require
> looking at *any* code: in general, what makes a line of code "breakable"
> (in any debugger, not just Firebug)?
>
"breakable" means the debugger can stop at a specific statement (can be
multiple statements within a single line of code).
Why is some code executable from the browser's point of view but not from
> the debugger's?
The simple answer is, that it may be a bug. Though without having an
example, it's impossible to confirm.
The longer answer is this:
Note that JavaScript engines try to do some execution optimizations when
parsing the code. E.g. they skip unreachable code like if(false) { ... }.
Debuggers need to turn these optimizations off in order to allow breaking
at breakpoints and do step debugging. Also JavaScript engines do not need
to take line numbers into account while debuggers do. Therefore debuggers
need to map the line numbers to the related code. This mapping may
sometimes be incorrect as bug 1013219
<https://bugzilla.mozilla.org/show_bug.cgi?id=1013219> shows.
@Mahks Doma: No, there are no iframes in that page, and no Ajax either.
> Also no linked libraries like jQuery or whatever -- I write almost all my
> own code from scratch. Some of the JS values were set via PHP, but that
> shouldn't matter; that's history by the time the debugger sees it. It is
> complex code, with nested functions, objects, conditionals, and branching
> logic, and more than one JS file linked into the html page. Only one of the
> JS files shows the breakpoints problem, but that code works well in the
> page and throws no errors.
>
Again, please post a link to a site, so your issue can be reproduced.
> My intuition says debugger "breakability" may have something to do with
> scope, or code branching... but I just don't see the pattern. *Somebody*
> must have written the code in Firebug that decides (not always correctly)
> which line numbers to turn green -- and that person must know what the
> logic is.
>
The logic basically comes from the platform side. The code for this is
implemented
in debuggerLib.js
<https://github.com/firebug/firebug/blob/923845aa917ead8bcd0390e98a14a694ccdce9ba/extension/content/firebug/debugger/debuggerLib.js#L324>.
Honza may know more about that logic. See also issue 5730
<https://code.google.com/p/fbug/issues/detail?id=5730>.
Note that marking lines as executable and actually stopping at those lines
are two different things.
Sebastian
--
You received this message because you are subscribed to the Google Groups
"Firebug" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/firebug.
To view this discussion on the web visit
https://groups.google.com/d/msgid/firebug/1198d621-4c05-4981-84dd-87b82a59584e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.