SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
4.
In the beginning there was ‘debugger’
http://nodejs.org/api/debugger.html
To debug in console:
node debug test.js
note: 'debug' not '--debug', this is a different command we'll see later
This hook to V8's debugger is what all
Node debug tools bind to.
5.
Debug command highlights
• Stepping
– cont, next, step, out - What you think they do
• Breakpoints
– setBreakpoint()/sb() - Set breakpoint on current
line or at statement
– clearBreakpoint/clearBreakpoint()/cb(...) - clear
breakpoint (duh)
6.
Debug command highlights
• Info
– backtrace/bt - Print backtrace of current execution frame
– watch(expr) - Add expression to watch list
– unwatch(expr) - Remove expression from watch list
– watchers - List all watchers and their values
– repl - Open debugger's repl for evaluation in debugging
script's context
• Execution control
– run - Run script (automatically runs on debugger's start)
– restart - Restart script
– kill - Kill script
7.
Can’t we use something a little less…
Arcane? Unusual? Ugly? 1990?
8.
Eclipse IDE
Eclipse Node Debugger Walk Through:
https://github.com/joyent/node/wiki/Using-
Eclipse-as-Node-Applications-Debugger
Chrome Dev Tools + V8 Debugger:
http://code.google.com/p/chromedevtools/
Warning, plug-in compatibility can be a
nightmare! Aptana or other highly customized
Eclipse based IDE's may not work.
9.
Eclipse advanced debugging
To debug with real source instead of
'VirtualProject' files
http://code.google.com/p/chromedevt
ools/wiki/FeatureDebugOnRealFiles
Screen capture of setup
http://www.youtube.com/watch?v=GV
xFFw7lkYg
10.
Webstorm IDE
Happy Node.js
debugging right out
of the box!
Coffeescript
debugging coming in
version 4.0!