Debugger not stopping at hard breakpoint in xul javascript.

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

Debugger not stopping at hard breakpoint in xul javascript.

Dennis Muhlestein
I'm trying to debug a firefox extension.  I deselected the "Exclude
Browser Files" from the Debug menu.  Walla, I can now see my extension
javascript file.

Next, I set a breakpoint where I'd like to stop.  The breakpoint IS
listed in the breakpoints window and it is a hard breakpoint.

When I execute the code in the extension however, the debugger does not
stop there.  I've verified that breakpoints DO stop for normal
javascript/web files.  Is there something  I am missing when debugging
JS from an extension?  I've tried setting breakpoints at all different
places in my extension javascript and the effect is always the same.
The debugger seems to be ignoring them.

I'm using FireFox 2.0.0.3 on Windows.

Thanks
Dennis
_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Debugger not stopping at hard breakpoint in xul javascript.

James Ross
Dennis Muhlestein wrote:
> I'm trying to debug a firefox extension.  I deselected the "Exclude
> Browser Files" from the Debug menu.  Walla, I can now see my extension
> javascript file.
>
> Next, I set a breakpoint where I'd like to stop.  The breakpoint IS
> listed in the breakpoints window and it is a hard breakpoint.

Where are you setting it? Is it code in a <script> block inside an XUL
file? Is it in an event handler? An associated JavaScript file? Is it
inside a function in the code? At the top level? How are you triggering
the code? Button? Event? Closing and re-opening your extension window?

--
James Ross <[hidden email]>
ChatZilla and Venkman Developer
_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Debugger not stopping at hard breakpoint in xul javascript.

John J Barton
In reply to this post by Dennis Muhlestein
(I assume you are using venkman). I don't know what you mean by a "hard
breakpoint".  Does the source have a dash '-' in front of the line you
breakpoint? That indicates a line that venkman thinks is in the scripts
line table.  If yes, then the script you breakpointed just isn't the
script your extension is running: the browser isn't breakpointing
because the code isn't running.  If no, then hmm, my guess would be the
same.  From the debuggers point of view there isn't anything special
about scripts from extensions.

John.

Dennis Muhlestein wrote:

> I'm trying to debug a firefox extension.  I deselected the "Exclude
> Browser Files" from the Debug menu.  Walla, I can now see my extension
> javascript file.
>
> Next, I set a breakpoint where I'd like to stop.  The breakpoint IS
> listed in the breakpoints window and it is a hard breakpoint.
>
> When I execute the code in the extension however, the debugger does not
> stop there.  I've verified that breakpoints DO stop for normal
> javascript/web files.  Is there something  I am missing when debugging
> JS from an extension?  I've tried setting breakpoints at all different
> places in my extension javascript and the effect is always the same. The
> debugger seems to be ignoring them.
>
> I'm using FireFox 2.0.0.3 on Windows.
>
> Thanks
> Dennis
_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Debugger not stopping at hard breakpoint in xul javascript.

Dennis Muhlestein
In reply to this post by James Ross
>
> Where are you setting it? Is it code in a <script> block inside an XUL
> file? Is it in an event handler? An associated JavaScript file? Is it
> inside a function in the code? At the top level? How are you triggering
> the code? Button? Event? Closing and re-opening your extension window?
>
Well, I tried setting the breakpoints at lots of different places to
find out if the method of triggering it was possibly the problem.  I set
breakpoints not only in my event handlers (like onload etc), but in
function call blocks that I can call by clicking clicking a menu item
from my overlay menu.

I have JS code in a separate JS file as well as in script blocks in the
XUL file but I didn't try much with the script blocks.

Thanks
Dennis
_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Debugger not stopping at hard breakpoint in xul javascript.

Dennis Muhlestein
In reply to this post by John J Barton
John J. Barton wrote:
> (I assume you are using venkman). I don't know what you mean by a "hard
> breakpoint".  Does the source have a dash '-' in front of the line you
> breakpoint? That indicates a line that venkman thinks is in the scripts
> line table.  If yes, then the script you breakpointed just isn't the
> script your extension is running: the browser isn't breakpointing
> because the code isn't running.  If no, then hmm, my guess would be the
> same.  From the debuggers point of view there isn't anything special
> about scripts from extensions.

I meant a hard breakpoint by an actual breakpoint that is set and has a
"B" in the source window.  i.e., not a future breakpoint with an "F".

The source lines do indeed have a "-" in front of the line I'm trying to
set.

You may be right about the browser not running that code.  I don't see
any other source files that match the name of my source files in my
extension.  Is is possible they are somehow renamed in FireFox/Venkman?
  The code is running.  I have a debug function dumping information to
the console, and the exact places I'm trying to break at are printing
debug information when I click or handle an event.

Thanks for your input.
Dennis
_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Debugger not stopping at hard breakpoint in xul javascript.

Dennis Muhlestein
In reply to this post by John J Barton
John J. Barton wrote:
> (I assume you are using venkman). I don't know what you mean by a "hard
> breakpoint".  Does the source have a dash '-' in front of the line you
> breakpoint? That indicates a line that venkman thinks is in the scripts
> line table.  If yes, then the script you breakpointed just isn't the
> script your extension is running: the browser isn't breakpointing
> because the code isn't running.  If no, then hmm, my guess would be the
> same.  From the debuggers point of view there isn't anything special
> about scripts from extensions.
>

I've done a little more experimentation with the location that I set
breakpoints at.  I found that if I set a breakpoint in a function call,
having done no other breakpoints yet that the code stops for debugging.
  If I set a breakpoint in an event handler that is called by adding the
function to an event with "addEventListener", that the breakpoint is not
called.  Furthermore, once I've tried that, the other breakpoints no
longer work.  If I restart FireFox, the 1st type of breakpoints can be
called again but I tried the process a couple times and got the same
result each time.

Is there some special circumstance that deals with breakpoints inside of
event handler code?

Thanks
Dennis
_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Debugger not stopping at hard breakpoint in xul javascript.

James Ross
Dennis Muhlestein wrote:
> Is there some special circumstance that deals with breakpoints inside of
> event handler code?

Venkman does nothing special, and if anything special is needed it's a
bug in the underlying JavaScript engine or (more likely) DOM code that
is pissing about with the event.

I have never had any problem setting a hard breakpoint in script files
in extensions.

There is one technique that will always work, although I rarely need to
employ it:

- Place the 'debugger' statement in the code where you wish to break.
You can put it inside its own if, or wherever ever you'd like to stop.
- Make sure Pretty Print is turned on in Venkman.
- Run the code.

The 'debugger' statement will force the JavaScript engine to break into
the debugger (i.e. Venkman) if it is open. Pretty Print will avoid any
issues where DOM/JavaScript engine are returning mismatching line
numbers (commonly a problem for inline event handlers, but can occur in
other places).

--
James Ross <[hidden email]>
ChatZilla and Venkman Developer
_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Debugger not stopping at hard breakpoint in xul javascript.

John J Barton
In reply to this post by Dennis Muhlestein
Dennis Muhlestein wrote:
>
> Is there some special circumstance that deals with breakpoints inside of
> event handler code?

In FF 2.0 at least the browser generated event handlers (onclick) have
their line table off by one line.

John
_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Debugger not stopping at hard breakpoint in xul javascript.

Dennis Muhlestein
In reply to this post by James Ross
James Ross wrote:

> Dennis Muhlestein wrote:
>> Is there some special circumstance that deals with breakpoints inside
>> of event handler code?
>
> Venkman does nothing special, and if anything special is needed it's a
> bug in the underlying JavaScript engine or (more likely) DOM code that
> is pissing about with the event.
>
> I have never had any problem setting a hard breakpoint in script files
> in extensions.
>
> There is one technique that will always work, although I rarely need to
> employ it:
>
> - Place the 'debugger' statement in the code where you wish to break.
> You can put it inside its own if, or wherever ever you'd like to stop.
> - Make sure Pretty Print is turned on in Venkman.
> - Run the code.
>
> The 'debugger' statement will force the JavaScript engine to break into
> the debugger (i.e. Venkman) if it is open. Pretty Print will avoid any
> issues where DOM/JavaScript engine are returning mismatching line
> numbers (commonly a problem for inline event handlers, but can occur in
> other places).
>


Ok, to regain my sanity, I created a new profile in FireFox, started
with 0 extensions and added Venkman.  Then I installed my own extension.
  In this profile, I can now debug the event handler.  I can only assume
that there is some problem in my other profile, or a problem with
another extension in my other profile that is interfering with the event
handling debugging.  I tried all the the things listed in your comments
and the debugger would never stop in the event handler code.  It does
indeed work in my new profile however.

Thanks for you comments.
Dennis
_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Debugger not stopping at hard breakpoint in xul javascript.

Gijs Kruitbosch ("Hannibal")
Dennis Muhlestein wrote:

> James Ross wrote:
>> Dennis Muhlestein wrote:
>>> Is there some special circumstance that deals with breakpoints inside
>>> of event handler code?
>>
>> Venkman does nothing special, and if anything special is needed it's a
>> bug in the underlying JavaScript engine or (more likely) DOM code that
>> is pissing about with the event.
>>
>> I have never had any problem setting a hard breakpoint in script files
>> in extensions.
>>
>> There is one technique that will always work, although I rarely need
>> to employ it:
>>
>> - Place the 'debugger' statement in the code where you wish to break.
>> You can put it inside its own if, or wherever ever you'd like to stop.
>> - Make sure Pretty Print is turned on in Venkman.
>> - Run the code.
>>
>> The 'debugger' statement will force the JavaScript engine to break
>> into the debugger (i.e. Venkman) if it is open. Pretty Print will
>> avoid any issues where DOM/JavaScript engine are returning mismatching
>> line numbers (commonly a problem for inline event handlers, but can
>> occur in other places).
>>
>
>
> Ok, to regain my sanity, I created a new profile in FireFox, started
> with 0 extensions and added Venkman.  Then I installed my own extension.
>  In this profile, I can now debug the event handler.  I can only assume
> that there is some problem in my other profile, or a problem with
> another extension in my other profile that is interfering with the event
> handling debugging.  I tried all the the things listed in your comments
> and the debugger would never stop in the event handler code.  It does
> indeed work in my new profile however.
>
> Thanks for you comments.
> Dennis

Did you have Firebug installed? Having two JS debuggers at once is
"iffy" at best, given some of the core implementation of JS debugging.

~ Gijs
_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Debugger not stopping at hard breakpoint in xul javascript.

Dennis Muhlestein
> Did you have Firebug installed? Having two JS debuggers at once is
> "iffy" at best, given some of the core implementation of JS debugging.

I did, but I've had it disabled.  I'll try again without the plugin
installed at all and see if that is the culprit.

_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Debugger not stopping at hard breakpoint in xul javascript.

Dennis Muhlestein
In reply to this post by Gijs Kruitbosch ("Hannibal")

> Did you have Firebug installed? Having two JS debuggers at once is
> "iffy" at best, given some of the core implementation of JS debugging.
>

Sure enough, simply disabling Firebug with Firebugs own enabler/disabler
wasn't enough.  Completely disabling the plugin or uninstalling it
solved the problem.

Thanks
Dennis
_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Debugger not stopping at hard breakpoint in xul javascript.

John J Barton
Dennis Muhlestein wrote:
>
>> Did you have Firebug installed? Having two JS debuggers at once is
>> "iffy" at best, given some of the core implementation of JS debugging.
>>
>
> Sure enough, simply disabling Firebug with Firebugs own enabler/disabler
> wasn't enough.  Completely disabling the plugin or uninstalling it
> solved the problem.
>

I suppose the problem is Firebug's use of initAtStartup:
             var jsd = DebuggerService.getService(jsdIDebuggerService);
             jsd.initAtStartup = true;
Value is never set false in Firebug; I guess it maybe a global pref
stored by jsd across executions?

John.
_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Debugger not stopping at hard breakpoint in xul javascript.

timeless-3
On Apr 21, 6:50 pm, "John J. Barton" <[hidden email]>
wrote:
> I suppose the problem is Firebug's use of initAtStartup:
>              var jsd = DebuggerService.getService(jsdIDebuggerService);
>              jsd.initAtStartup = true;
> Value is never set false in Firebug; I guess it maybe a global pref
> stored by jsd across executions?

it's not a pref, but it is a global setting stored by xpcom.

_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger