A Goja debugger's CLI frontend application to demonstrate the capabilities of the NEW Goja debugger.
This repositories contains an example application in Go for testing the debugger functionality I'm developing for Goja and a bunch of scripts in JavaScript, one (gen-srcmap.js
) for generating sourcemaps for your JavaScript files and two other (test_*.js
) for testing the debugger app.
To run the debugger application, just run go build
in the cloned project on your machine, assuming you have Go.
git clone https://github.com/mostafa/goja_debugger
cd goja_debugger
go build
There are two scripts along with their sourcemaps for testing the debugger functionality. If you want to debug your own scripts, you might need to use Node.js to generate your own sourcemap for your JavaScript, which helps the debugger application easily pinpoint the lines in your script.
cd scripts
npm i
node gen-srcmap.js test.js > test.js.map
node gen-srcmap.js test_prime.js > test_prime.js.map
There's just one subcommand in the debugger application, inspect
. If you use it, it'll tell the compiler to emit debugger
instruction in your program and also let's the JS VM (Goja VM) to run your script in debug mode. Otherwise it'll just run the script normally. Also, you can pass line
after inspect
to have line numbers printed on the debug[1]>
prompt, instead of program counter (default).
$ ./goja_debugger inspect scripts/test.js
Welcome to Goja debugger
Type 'help' or 'h' for list of commands.
Loaded sourcemap from: scripts/test.js.map
Break on start in scripts/test.js:1
debug[0]> r
Break on debugger statement in scripts/test.js:11
debug[3]> l
7 let pest = 2
8 return val + 2
9 }
10
> 11 let i = 1;
12 console.log(i)
13 // eval('console.log(i + 2)')
14
15 i = 2
debug[3]>
When the debugger starts, it'll pause, so that you instruct it to run a command or set a breakpoint. Most of the following command are supported:
setBreakpoint, sb Set a breakpoint on a given file and line
clearBreakpoint, cb Clear a breakpoint on a given file and line
breakpoints, b List all known breakpoints
run, r Run program until a breakpoint/debugger statement if program is not started
(ProgramStartActivation is disabled, so run doesn't work for now)
next, n Continue to next line in current file
cont, c Resume execution until next debugger line
step, s Step into, potentially entering a function
out, o Step out, leaving the current function (not implemented yet)
exec, e Evaluate the expression and print the value
list, l Print the source around the current line where execution is currently paused
print, p Print the provided variable's value
backtrace, bt Print the current backtrace
help, h Print this very help message
quit, q Exit debugger and quit (Ctrl+C)
compiler.go
and others and use a flag for debugMode
dap
branch (boilerplate for now)AGPL v3 or later
k6 extension to load test Apache Kafka with support for various serialization formats, SASL, TLS, compression and beyond
State-of-the-art native debugging tool
blockchain client with js
Providing HarfBuzz shaping library for client/server side JavaScript projects
Lightweight, user-friendly onboarding tour library
My configuration files for RiverWM using Go and Rose-Pine Colorscheme.
a package for type checking the urls and associated views for django
SSE over QUIC protocol