Created
December 10, 2011 16:37
-
-
Save indutny/1455534 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/tmp > node debug node-debugger-example.js | |
< debugger listening on port 5858 | |
connecting... ok |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
debug> help | |
Commands: run (r), cont (c), next (n), step (s), out (o), backtrace (bt), setBreakpoint (sb), clearBreakpoint (cb), | |
watch, unwatch, watchers, repl, restart, kill, list, scripts, breakpoints, version | |
debug> list() | |
1 var http = require('http'); | |
2 | |
3 http.createServer(function(req, res) { | |
4 if (req.url === '/') { | |
5 // Index page | |
debug> next | |
break in node-debugger-example.js:3 | |
1 var http = require('http'); | |
2 | |
3 http.createServer(function(req, res) { | |
4 if (req.url === '/') { | |
5 // Index page | |
debug> list(10) | |
1 var http = require('http'); | |
2 | |
3 http.createServer(function(req, res) { | |
4 if (req.url === '/') { | |
5 // Index page | |
6 res.end('hello world'); | |
7 } else { | |
8 // Favicon and everything else | |
9 res.writeHead(400); | |
10 res.end('not found'); | |
11 } | |
12 }).listen(8080); | |
13 }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
debug> setBreakpoint('node-debugger-example', 6) | |
1 var http = require('http'); | |
2 | |
3 http.createServer(function(req, res) { | |
4 if (req.url === '/') { | |
5 // Index page | |
* 6 res.end('hello world'); | |
7 } else { | |
8 // Favicon and everything else | |
debug> cont | |
break in node-debugger-example.js:6 | |
4 if (req.url === '/') { | |
5 // Index page | |
* 6 res.end('hello world'); | |
7 } else { | |
8 // Favicon and everything else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
debug> repl | |
Press Ctrl + C to leave debug repl | |
> res.<TAB> | |
res.__defineGetter__ res.__defineSetter__ res.__lookupGetter__ res.__lookupSetter__ res.constructor res.hasOwnProperty | |
res.isPrototypeOf res.propertyIsEnumerable res.toLocaleString res.toString res.valueOf | |
res._events res._hasBody res._last res._trailer res.chunkedEncoding res.connection | |
res.finished res.output res.outputEncodings res.shouldKeepAlive res.socket res.useChunkedEncodingByDefault | |
res.writable | |
> res.end('hahahaha') | |
true | |
> | |
debug> cont | |
break in node-debugger-example.js:6 | |
4 if (req.url === '/') { | |
5 // Index page | |
* 6 res.end('hello world'); | |
7 } else { | |
8 // Favicon and everything else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
debug> watch('req.url') | |
debug> watchers | |
0: req.url = "/" | |
debug> n | |
break in node-debugger-example.js:12 | |
Watchers: | |
0: req.url = "/" | |
10 res.end('not found'); | |
11 } | |
12 }).listen(8080); | |
13 }); | |
debug> unwatch('req.url') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment