INsanE Alchemist
INsanE Alchemist
MModular
Created by INsanE Alchemist on 12/12/2024 in #questions
How to configure execution arguments for mojo-lldb in VSCode
Is there a way to pass command-line parameters to the Mojo debugger, so that the following code prints out: I'm looking for the launcher.json configuration that would be equivalent to:
$ mojo debug -D DEBUG ./debug_mode.mojo
$ mojo debug -D DEBUG ./debug_mode.mojo
So that I can get the code below: debug_mode.mojo
from sys import is_defined

alias DEBUG = is_defined["DEBUG"]()

fn main() raises:
@parameter
if DEBUG: print("\nIn debug ...")

print("\nDone.")
from sys import is_defined

alias DEBUG = is_defined["DEBUG"]()

fn main() raises:
@parameter
if DEBUG: print("\nIn debug ...")

print("\nDone.")
To print out the following, when I Start Debugging
text
In debug ...

Done.
text
In debug ...

Done.
I believe this is the correct json block to edit, but I cannot find the correct parameters to configure.
"configurations": [
{
"type": "mojo-lldb",
"request": "launch",
"name": "Mojo: Debug Current Mojo file",
"description": "Launch and debug a Mojo file given its path.",
"mojoFile": "${file}",
"args": ["-D", "DEBUG"],
"env": [],
"cwd": "${workspaceFolder}",
"runInTerminal": false
},
"configurations": [
{
"type": "mojo-lldb",
"request": "launch",
"name": "Mojo: Debug Current Mojo file",
"description": "Launch and debug a Mojo file given its path.",
"mojoFile": "${file}",
"args": ["-D", "DEBUG"],
"env": [],
"cwd": "${workspaceFolder}",
"runInTerminal": false
},
as you can see I've tried setting "args": ["-D", "DEBUG"],, but that sets the command line arguments for debug_mode.mojo. If this can only be done in another way, please can someone direct me to the path of enlightenment.
4 replies