sudo apt update
sudo apt upgrade
sudo apt install git build-essential cmake
git clone https://github.com/clemenscodes/njvm.git
cd njvm
cmake -B build
make -C build
./njvm [options] <code file>
--stack <n> set stack size to n KBytes (default: n = 64)
--heap <n> set heap size to n KBytes (default: n = 8192)
--gcstats show garbage collection stats
--gcpurge purge old objects after collection
--debug start virtual machine in debug mode
--version show version and exit
--help show this help and exit
To debug a ninja binary, pass --debug
as an option.
The debugger has several features:
- Inspect:
- Stack
- Static Data Area
- List Instruction Register
- Step through the binary an instruction at a time
- Run the entire program until the end
- Set a breakpoint at which the running program will jump in debug mode
- Quit the VM
-
inspect
or simplyi
.-
stack
ors
to inspect the current stack. -
data
ord
to inspect the current static data area.
-
list
or simplyl
.
step
or simplys
.
run
or simplyr
.
-
breakpoint
or simplyb
. -
The debugger will expect an address of the instruction register at which the debugger should jump in.
-
If the entered address is
-1
, a currently existing breakpoint will be cleared. Otherwise the entered address must be an unsigned integer.
quit
or simplyq
.