Speaker: Michelle Petersen
Add breakpoints to a script for debugging.


View video

Welcome to Aptana. My name is Michelle, and I'm going to be demonstrating breakpoint functionality of the Aptana JavaScript debugger. To start, I'm going to click the "debug" button to debug my web page.

It opens the web page in Firefox, and I have a little breakpoint here that I'm going to use. Now, for this demo, I've got a "start test" button that will suspend the web page for me, and it asks me to switch to the "debug perspective," which is what we want to do because we're debugging.

And I have it set up to break on the keyword "debugger," which it's doing. And what I'm going to do right now is set a breakpoint here on this line that says "dump breakpoint line," so I'm going to right-click in the margin and select "toggle breakpoint." This adds a breakpoint at this point.

Now, if I click "resume," it'll run until it breaks on that breakpoint. Now, the next thing I'm going to tell you is how to add a conditional breakpoint, so we're going to add a breakpoint on a line, where we want it to only break after it's hit that line five times, so this is good if you're checking things in loops.

So I'm going to add this breakpoint here under "step into." I'm going to right-click in the margin and select "toggle breakpoint," and then I'm going to select that breakpoint, right click and choose "breakpoint properties," and I'm going to check "hit count," and I'm going to type "five."

This will mean that it will break after it's hit this line five times. And if I want this to be enabled, I want to make sure that this "enabled" box is checked, so I'll click "okay." Now, I'm going to click "resume" again, and it'll break once it's hit this line five times, and you can see down here in the console, it is showing me that I have a hit point of five on that line.

And the next thing I'm going to do is I'm going to switch and show you how you can debug in a popup window. Now, we're going to use breakpoints to demonstrate this, and I have another file open here called "debug_timer", and I'm going to add a breakpoint to that. I'm going to do it at the breakpoint when it's updating the timer here. You'll see how this all fits together in a second.

So I'll right-click at a breakpoint. I'm going to switch back to my demo page, and we're going to click "resume." I'll switch back to the window, and I'm going to go down to this one here to debug in a popup window. I'll click "start test" and it opens my popup window, and I'll click "start," and you could see that it stopped after it hit one second.

So if you go back to Aptana, and we look at "debug timer," you can see that it's broken where the timer updates.

That concludes this presentation. Thank you.

[End of Video]