README
App::MoarVM::Debug
The MoarVM Debugger allows you to connect to a local MoarVM instance - if it was started with the --debug-port argument passed to MoarVM itself - and control execution of threads, introspect the stack and individual objects.
MoarVM also takes the --debug-suspend commandline argument, which causes MoarVM to immediately pause execution at the start.
Start the moar-remote script and pass the port you used for --debug-port and it should connect.
Type "help" in the debugger's CLI to see what commands are available to you.
Beta Use Instructions
Install the module (you may need to disable tests):
zef install --/test App::MoarVM::Debug
Locate
perl6-m
bash script (orperl6.bat
on Windows):locate perl6-m
Copy it to some other name:
cp perl6-m perl6-moar-remote-m
Edit it to include
--debug-port=9999
and--debug-suspend
inmoar
options:[ā¦] install/bin/moar --debug-port=9999 --debug-suspend --execname=[ā¦]
Start the program you want to debug using that new script:
perl6-moar-remote-m my-script.pl
Start the debugger CLI app and have it connect to the same port that's in the shell script from step 4:
moar-remote 9999
(Optional) Write
assume thread 1
to assume tracking of first threadSet a breakpoint
breakpoint "my-script.pl" 1234 1 1
the string is the filename and1234
is the line number (1 1
is the secret ingredient). Ensure the line number doesn't point to an empty line.Type
resume
to run your script.The breakpoint will trigger, you can type
all lexicals
to view all lexicals. The numbers shown next to them in bold are "handle" numbers.Find the object you want to dump and run
metadata 1234
(1234
is the handle number).If the features includes
attributes
, you can enterattributes 1234
for this object.If the features includes
positional
,positionals 1234
will work.If the features includes
associative
,associatives 1234
will work.The
metadata
command is only needed if you don't know which of these commands is useful for any given type.
Type
help
to see all of the available commands.
Known Issues
The only stepping mode currently available is Step Into.
Backtraces will show incorrect line numbers.