JSDB     Home    License    Download    Tutorial    Reference    Projects    Feedback    History

How to use the JSDB remote debugger

The easy way

Run jsdb.exe debug.js myprogram.js

A separate process will start to run myprogram.js, while a web browser will open the debugging console.

The hard way

1. Download JSDB and unzip.
2. Start two command shells

Shell A will be used to control the debugger. It prints a network 
address. The port is different every time.
c:\temp\>jsdb debuggerconsole.js
127.0.0.1:1334

Shell B will run the program that you're debugging. If you want to 
debug "test.js", type this:
c:\temp\>jsdb debug.js test.js 127.0.0.1:1334 ...

Shell A will come to life. It'll print
LOAD C:\temp\test.js#1-9
STOP FUNCTION
>

This means that the script "test.js" has been loaded, and you're 
stopped at the entry point to the main function. In Shell A, type 
"help" and press Enter to get a list of the available commands.

>help
LINE SOURCE STACK SCRIPTS EVALUATE INSPECT
BREAK CLEAR RUN STEP SKIP RETURN STOP THROW

Set a breakpoint at line 4
>break c:\temp\test.js#4

List breakpoints
>break
c:\temp\test.js#4

List scripts
>scripts
c:\temp\test.js#1-9

Next instruction
>step
STOP STEP C:\temp\test.js#1

Soure code of the current script
>source
...

Source code from any loaded script
>source c:\temp\test.js

Single line
>line c:\temp\test.js#5
5       a = {x:45, y:33}
>line #5
5       a = {x:45, y:33}

Or just the current line
>line
...

Run until the breakpoint
>run
>STOP BREAK c:\temp\test.js#4

Clear a breakpoint
>clear c:\temp\test.js#4

Clear all breakpoints in a script
>clear c:\temp\test.js

Clear all breakpoints
>clear

List the names of local variables
>inspect
...

Inspect a particular object
>inspect a
x
y

Find the value
>evaluate a.x
Integer 45

For objects, returns the bytes of memory used
>evaluate a
Object 145

Stop debugging
>stop