Skip to content

Commit

Permalink
version 0.1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
dannycoates committed Aug 15, 2011
1 parent 41922a7 commit 706b78c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 18 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
@@ -1,3 +1,7 @@
v0.1.9

* fixed page refresh

v0.1.8

* bug fixes
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "node-inspector",
"version": "0.1.8",
"version": "0.1.9",
"description": "Web Inspector based nodeJS debugger",
"homepage": "http://github.com/dannycoates/node-inspector",
"author": "Danny Coates <dannycoates@gmail.com>",
Expand Down
54 changes: 37 additions & 17 deletions readme.md
Expand Up @@ -8,6 +8,9 @@ Node Inspector is a debugger interface for nodeJS using the WebKit Web Inspector
- versions: 0.3.0 or later
* [npm](http://github.com/isaacs/npm)
* A WebKit based browser: Chrome, Safari, etc.

> **BROKEN** on Chrome 14+
* Optional [v8-profiler](http://github.com/dannycoates/v8-profiler) to use the profiles panel

### Install
Expand All @@ -16,35 +19,52 @@ Node Inspector is a debugger interface for nodeJS using the WebKit Web Inspector

npm install -g node-inspector

### Debugging
### Enable debug mode

As an example lets debug test/hello.js, from the root project directory (node-inspector)
To use node-inspector, enable debugging on the node you wish to debug.
You can either start node with a debug flag like:

1. start the inspector in the background
node --debug your/node/program.js

node-inspector &
or, to pause your script on the first line:

2. start the node instance to debug. Use `--debug-brk` to pause the script on the first line
node --debug-brk your/short/node/script.js

node --debug test/hello.js
Or you can enable debugging on a node that is already running by sending
it a signal:

3. open http://127.0.0.1:8080/debug?port=5858 in your favorite WebKit based browser
1. Get the PID of the node process using your favorite method. `pgrep` or `ps -ef` are good

> Chrome 5 users **MUST** use 127.0.0.1 **NOT** localhost or the browser will not connect to the debugger
$ pgrep -l node
2345 node your/node/server.js

4. you should now see the javascript source from nodeJS
2. Send it the USR1 signal

5. select the hello.js script and set some breakpoints (far left line numbers)
$ kill -s USR1 2345

6. now open http://127.0.0.1:8124/ in a new tab then go back to inspector tab
Great! Now you are ready to attach node-inspector

7. click "Step over next function call" and observe changes in the RHS panel
### Debugging

1. start the inspector. I usually put it in the background

node-inspector &

8. then watch the [screencasts](http://www.youtube.com/view_play_list?p=A5216AC29A41EFA8)
2. open http://127.0.0.1:8080/debug?port=5858 in your favorite WebKit based browser

3. you should now see the javascript source from node. If you don't,
click the scripts tab.

4. select a script and set some breakpoints (far left line numbers)

5. then watch the [screencasts](http://www.youtube.com/view_play_list?p=A5216AC29A41EFA8)

For more information on getting started see the [wiki](http://github.com/dannycoates/node-inspector/wiki/Getting-Started---from-scratch)

## Options
node-inspector works almost exactly like the web inspector in Safari and
Chrome. Here's a good [overview](http://code.google.com/chrome/devtools/docs/scripts.html) of the UI

## Inspecotr options

--web-port=[port] port to host the inspector (default 8080)

Expand All @@ -62,10 +82,12 @@ This is beta quality code, so use at your own risk:

* be careful about viewing the contents of Buffer objects, each byte is displayed as an individual array element, for anything but tiny Buffers this will take too long to render
* while not stopped at a breakpoint the console doesn't always behave as you might expect
* closing the browser does not stop debugging, you must stop node-inspector manually

## Profiling

**VERY EXPERIMENTAL**
I don't recommend using this yet

To use the profiles panel, install the v8-profiler module:

npm install v8-profiler
Expand All @@ -85,8 +107,6 @@ To use it do something like:
Then view the profiling results with the profiles panel in node-inspector. You can
also take heap snapshots on demand from the profiles panel.



## Thanks

This project respectfully uses code from and thanks the authors of:
Expand Down

0 comments on commit 706b78c

Please sign in to comment.