miden-debug 0.4.2

An interactive debugger for Miden VM programs
Documentation
[config]
default_to_workspace = false
skip_core_tasks = true
skip_git_env_info = true
modify_core_tasks = { private = true, namespace = "default" }
init_task = "init"

[env]
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
CARGO_MAKE_CARGO_VERBOSE_FLAGS = { source = "${CARGO_MAKE_CI}", default_value = "", mapping = { "true" = "--verbose" } }
CARGO_MAKE_RUST_SCRIPT_PROVIDER = "rust-script"
CARGO_MAKE_USE_WORKSPACE_PROFILE = true
CARGO_MAKE_CARGO_BUILD_TEST_FLAGS = "--no-fail-fast"
CARGO_TARGET_DIR = { value = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target", condition = { env_not_set = [
    "CARGO_TARGET_DIR",
] } }
BACKTRACE_DEFAULT = { source = "${CARGO_MAKE_CI}", mapping = { "true" = "1", "false" = "0" } }
RUST_BACKTRACE = { value = "${BACKTRACE_DEFAULT}", condition = { env_not_set = [
    "RUST_BACKTRACE",
] } }
LOCAL_BIN_DIR = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/bin"
LOCAL_INSTALL_DIR = "${LOCAL_BIN_DIR}/${CARGO_MAKE_RUST_TARGET_TRIPLE}"

# Workaround for https://github.com/0xMiden/miden-vm/issues/2025
RUST_MIN_STACK = 16777216

[env.development]
MIDEN_DEBUG_BUILD_PROFILE = "debug"

[env.production]
MIDEN_DEBUG_BUILD_PROFILE = "release"

[tasks.init]
script_runner = "@duckscript"
script = '''
args = split ${CARGO_MAKE_TASK_ARGS} " "
while not array_is_empty ${args}
  next_arg = array_get ${args} 0
  if starts_with ${next_arg} "--target"
      target_arg = array_get ${args} 1
      trimmed_target = trim ${target_arg}
      set_env CARGO_TARGET_ARG ${trimmed_target}
      array_clear ${args}
  else
      array_remove ${args} 0
  end
end
if ${CARGO_TARGET_ARG}
  set_env CARGO_ARTIFACT_DIR "${CARGO_TARGET_DIR}/${CARGO_TARGET_ARG}/${MIDEN_DEBUG_BUILD_PROFILE}"
else
  set_env CARGO_ARTIFACT_DIR "${CARGO_TARGET_DIR}/${MIDEN_DEBUG_BUILD_PROFILE}"
end
cm_run_task print-env
'''

[tasks.default]
category = "Build"
description = "Default task builds the debugger"
alias = "build"

[tasks.print-env]
category = "Tools"
run_task = [
    { name = [
        "print-build-env",
        "print-ci-env",
        "print-rust-env",
        "print-cargo-env",
    ] },
]

[tasks.print-build-env]
private = true
script = ['''
#!@duckscript
echo "*************************************"
echo "Build Environment:"
echo "    Task: ${CARGO_MAKE_TASK}"
echo "    Task Arguments: ${CARGO_MAKE_TASK_ARGS}"
echo "    Command: ${CARGO_MAKE_COMMAND}"
echo "    Working Directory: ${CARGO_MAKE_WORKING_DIRECTORY}"
echo "    Target Directory: ${CARGO_TARGET_DIR}"
echo "    Profile: ${CARGO_MAKE_PROFILE}"
echo "    Bin Directory: ${LOCAL_BIN_DIR}"
echo "    Install Directory: ${LOCAL_INSTALL_DIR}"
echo "    Target Triple: ${CARGO_MAKE_RUST_TARGET_TRIPLE}"
echo "    RUST_BACKTRACE: ${RUST_BACKTRACE}"
echo "*************************************"
''']

[tasks.print-ci-env]
private = true
condition = { env = { "CARGO_MAKE_CI" = "true" } }
script = ['''
#!@duckscript
echo "*************************************"
echo "CI:"
echo "    CI: ${CARGO_MAKE_CI}"
echo "    PR: ${CARGO_MAKE_PR}"
echo "    Branch Name: ${CARGO_MAKE_CI_BRANCH_NAME}"
echo "    CI Vendor: ${CARGO_MAKE_CI_VENDOR}"
echo "*************************************"
''']

[tasks.print-rust-env]
category = "Tools"
condition = { env_set = ["CARGO_MAKE_RUST_CHANNEL"] }
script = ['''
#!@duckscript
output = exec --fail-on-error rustc "--version"
assert_eq ${output.code} 0
rustc_version_parts = split ${output.stdout} " "
hash_raw = array_get ${rustc_version_parts} 2
hash = replace ${hash_raw} "(" ""
date_raw = array_get ${rustc_version_parts} 3
date = replace ${date_raw} ")\n" ""
release ${rustc_version_parts}


echo "*************************************"
echo "Rust:"
echo "    Version: ${CARGO_MAKE_RUST_VERSION}"
echo "    Channel: ${CARGO_MAKE_RUST_CHANNEL}"
echo "    Build Hash: ${hash}"
echo "    Build Date: ${date}"
echo "    Target Arch: ${CARGO_MAKE_RUST_TARGET_ARCH}"
echo "    Target Env: ${CARGO_MAKE_RUST_TARGET_ENV}"
echo "    Target OS: ${CARGO_MAKE_RUST_TARGET_OS}"
echo "    Pointer Width: ${CARGO_MAKE_RUST_TARGET_POINTER_WIDTH}"
echo "    Target Triple: ${CARGO_MAKE_RUST_TARGET_TRIPLE}"
echo "*************************************"
''']

[tasks.print-cargo-env]
category = "Tools"
condition = { env_set = ["CARGO_MAKE_CARGO_HOME"] }
script = ['''
#!@duckscript
echo "*************************************"
echo "Cargo:"
echo "    Home: ${CARGO_MAKE_CARGO_HOME}"
echo "    Profile: ${CARGO_MAKE_CARGO_PROFILE}"
echo "*************************************"
''']

[tasks.format]
category = "Development"
dependencies = ["format-rust"]

[tasks.check-format]
description = "Runs cargo fmt to check appropriate code format."
category = "Test"
command = "cargo"
args = ["fmt", "--", "--check"]
dependencies = ["install-rustfmt"]

[tasks.format-rust]
category = "Development"
description = "Formats source code (Rust)"
command = "cargo"
toolchain = "nightly"
args = ["fmt"]
dependencies = ["install-rustfmt"]

[tasks.install-rustfmt]
category = "Development"
description = "Installs cargo rustfmt plugin."
env.CFG_RELEASE = { value = "${CARGO_MAKE_RUST_VERSION}", condition = { env_not_set = [
    "CFG_RELEASE",
] } }
env.CFG_RELEASE_CHANNEL = { value = "${CARGO_MAKE_RUST_CHANNEL}", condition = { env_not_set = [
    "CFG_RELEASE_CHANNEL",
] } }
install_crate = { crate_name = "rustfmt-nightly", rustup_component_name = "rustfmt", binary = "rustfmt", test_arg = "--help" }

[tasks.bloat]
category = "Development"
description = "Run cargo-bloat"
command = "cargo"
args = ["bloat", "${@}"]

[tasks.miden-debug]
category = "Build"
description = "Builds miden-debug and installs it to the bin folder"
run_task = [{ name = ["build", "install-miden-debug-locally"]}]

[tasks.build]
category = "Build"
description = "Runs cargo build on the workspace"
command = "cargo"
args = ["build", "--lib", "--bins", "${@}"]

[tasks.install]
category = "Install"
description = "Installs the debugger via cargo"
run_task = [{ name = ["install-miden-debug"] }]

[tasks.install-miden-debug]
category = "Install"
description = "Builds miden-debug and installs it globally via the cargo bin directory"
command = "cargo"
args = [
    "install",
    "--locked",
    "--force",
    "--bin",
    "miden-debug",
    "${@}"
]

[tasks.install-miden-debug-locally]
category = "Install"
description = "miden-debug and installs it globally via the cargo bin directory"
private = true
script_runner = "@duckscript"
script = '''
mkdir ${LOCAL_BIN_DIR}
src = concat ${CARGO_ARTIFACT_DIR} "/miden-debug"
dst = concat ${LOCAL_BIN_DIR} "/miden-debug"
cp ${src} ${dst}
'''

[tasks.check]
category = "Build"
description = "Runs cargo check on the workspace"
command = "cargo"
args = ["check", "${@}"]

[tasks.check-each]
category = "Build"
description = "Runs cargo check on each member of the workspace independently"
workspace = true
command = "cargo"
args = ["check", "${@}"]

[tasks.clean]
category = "Build"
description = "Clean build artifacts"
command = "cargo"
args = ["clean", "${@}"]

[tasks.update]
category = "Dependencies"
description = "Update dependencies to latest semver-compatible version"
command = "cargo"
args = ["update"]

[tasks.outdated]
category = "Dependencies"
description = "Look for dependencies with newer, possibly-incompatible versions"
command = "cargo"
args = ["outdated", "--workspace", "--root-deps-only"]

[tasks.check-deps]
category = "Dependencies"
description = "Check dependencies for lack of use, duplicates, vulnerabilities, etc."
run_task = [
    { name = [
        "unused",
        "duplicates",
        "audit",
    ] },
]

[tasks.unused]
category = "Dependencies"
description = "Check for unused dependencies"
command = "cargo"
args = ["machete", "--with-metadata"]

[tasks.duplicates]
category = "Dependencies"
description = "Check dependencies for multiple versions of the same crate"
command = "cargo"
args = ["tree", "--duplicate"]

[tasks.audit]
category = "Dependencies"
description = "Check dependencies for known vulnerabilities, deprecations"
command = "cargo"
args = ["audit"]

[tasks.test]
category = "Test"
description = "Runs all tests including integration node tests"
dependencies = ["test-rust"]


[tasks.test-rust]
category = "Test"
description = "Runs tests written in Rust"
command = "cargo"
args = [
    "nextest",
    "run",
    "@@remove-empty(CARGO_MAKE_CARGO_VERBOSE_FLAGS)",
    "@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )",
    "${@}",
]

[tasks.clippy]
description = "Runs clippy on the workspace"
category = "Development"
command = "cargo"
args = [
    "clippy",
    "--all",
    "--all-targets",
    "--",
    "-D",
    "clippy::all",
    "-D",
    "warnings",
]