https://github.com/leecade/node-debug
node debug note
https://github.com/leecade/node-debug
Last synced: 9 months ago
JSON representation
node debug note
- Host: GitHub
- URL: https://github.com/leecade/node-debug
- Owner: leecade
- License: mit
- Created: 2015-07-07T05:28:57.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-07-07T07:18:17.000Z (about 11 years ago)
- Last Synced: 2025-07-07T11:41:24.652Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 129 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-debug
node debug note
## Considering
- Hot config
- Remote control
- AOP monitoring
- Friendly debug node in chrome
## DEMO
1. run a example server
```js
node example/server.js
```
> Visit http://localhost:8001 to see the message
record the `pid`, then
2. enter debug mode and connect by the `pid`
```js
node example/debugger.js `pid`
```
Refresh the browser, you may see content has changed
----
## About node debug
### How to enter debug mode
- Way 1
startup with `--debug-brk` param
```js
node --debug-brk=5858 [filename]
```
- Way 2
Send a `SIGUSR1` signal to node process
> For example
```bash
$ kill -SIGUSR1 4162
```
When node process enter debug mode, there will open a TCP port for listen (default port is `5858`)
### Connect a debug process
```js
node debug localhost:5858
```
Then the process is hang on, type these basic commands:
c Go on
s Step into next function
o Step out of current function
### Debugger protocol
simple:
```js
var msg = {
'command': 'evaluate',
'arguments': {
'expression': 'global.message="' + 'newMessage' + '"',
'global': true
}
}
```
send the message:
```
client.req(msg, function (err, body, res) {})
```
### Ref
https://github.com/buggerjs/bugger-v8-client/blob/master/PROTOCOL.md
https://github.com/joyent/node/blob/master/lib/_debugger.js
https://github.com/oneapm/node-oneapm-debugger