Node Debug (built-in debugger)

?
R
Bash

Simple demonstration of attaching the node built-in debugger, setting a breakpoint, changing a variable assignment at runtime and using the REPL environment functionality of the debugger. Docs: https://nodejs.org/api/debugger.html

1# Node Debugger
2## Find PID of Node or Nodemon (via interactive shell on Docker, or bash shell on physical machine)
3ps -a
4
5## Start Debugger
6node debug -p 16
7
8## Set a breakpoint
9// res.render('index', { title: 'Express' });
10sb("routes/index.js",6);
11
12## Inspect Variable
13exec pageName
14
15## Next Line
16next
17
18## Change Variable
19exec pageName = "index"
20
21## Continue
22c
23
24## Start REPL Environment
25repl
26
27## Exit REPL
28ctrl+c
29
30## Stepping
31cont, c - Continue execution
32next, n - Step next
33step, s - Step in
34out, o - Step out
35pause - Pause running code (like pause button in Developer Tools)

Created on 6/16/2017