App::MoarVM::Debug
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::DebugLocate
perl6-mbash script (orperl6.baton Windows):locate perl6-mCopy it to some other name:
cp perl6-m perl6-moar-remote-mEdit it to include
--debug-port=9999and--debug-suspendinmoaroptions:[ā¦] 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.plStart 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 1to assume tracking of first threadSet a breakpoint
breakpoint "my-script.pl" 1234 1 1the string is the filename and1234is the line number (1 1is the secret ingredient). Ensure the line number doesn't point to an empty line.Type
resumeto run your script.The breakpoint will trigger, you can type
all lexicalsto 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(1234is the handle number).If the features includes
attributes, you can enterattributes 1234for this object.If the features includes
positional,positionals 1234will work.If the features includes
associative,associatives 1234will work.The
metadatacommand is only needed if you don't know which of these commands is useful for any given type.
Type
helpto see all of the available commands.
Known Issues
The only stepping mode currently available is Step Into.
Backtraces will show incorrect line numbers.