Developer Tools

vdebugger

Runs a program as a subprocess and reads back its debug and profile output.

Released v1.0.0 · 2026-09-28
Import
use "stdlib/debugger.ven"

Including the exit code.

vdebugger.ven
result = run_target("bin/venutian", "examples/loop.ven", [])
print map_get(result, "exit_code")
Reference (18 functions)

API reference

run_target(venutian_binary, path, extra_args)

Runs a target program under the plain interpreter (not the profiler) and returns the raw process result, unparsed.

result = run_target("bin/venutian", "examples/loop.ven", [])
print map_get(result, "exit_code")

run_target_profile(venutian_binary, path, extra_args)

Runs a target program under the profiler and returns the raw process result, unparsed.

result = run_target_profile("bin/venutian", "examples/loop.ven", [])
print map_get(result, "exit_code")

blank_diagnosis()

Builds a fresh diagnosis Map with every field defaulted to "no crash".

d = blank_diagnosis()
print map_get(d, "crashed")

parse_frame_line(text)

Parses one "Call stack at the point of the fault" line into a frame Map.

frame = parse_frame_line("  #0 <script> at examples/loop.ven:7")
print map_get(frame, "function_name")

parse_frames(lines, start_index)

Parses every "#N ..." stack frame line found at or after start_index.

frames = parse_frames(split_text(stderr_text, "\n"), 6)
print length(frames)

parse_error_text(stderr_text)

Parses a crashed run's raw stderr text into a full diagnosis Map.

d = parse_error_text(map_get(result, "stderr"))
print map_get(d, "code")

diagnose_crash(venutian_binary, path)

Runs a program with no extra command-line arguments and diagnoses whether it crashed, this module's simplest end-to-end entry point.

d = diagnose_crash("bin/venutian", "stdlib/tests/fixtures/vdebugger_crash.ven")
print map_get(d, "crashed")

diagnose_crash_with_args(venutian_binary, path, extra_args)

Runs a program, forwarding extra_args to it, and diagnoses whether it crashed.

d = diagnose_crash_with_args("bin/venutian", "examples/loop.ven", ["10000"])
print map_get(d, "crashed")

source_line_at(path, line_number)

print source_line_at("examples/loop.ven", 7)

format_frame(frame, show_source)

Formats one stack frame as " #N name at file:line", optionally followed by its actual source line.

frame = parse_frame_line("  #0 <script> at examples/loop.ven:7")
print format_frame(frame, yes)

format_diagnosis(diagnosis, show_source)

Renders a diagnosis Map as a multi-line, human-readable crash report.

d = diagnose_crash("bin/venutian", "stdlib/tests/fixtures/vdebugger_crash.ven")
print format_diagnosis(d, yes)

parse_profile_table(stdout_text)

Parses a printed venutian profile report into structured rows.

rows = parse_profile_table(map_get(result, "stdout"))
print length(rows)

run_profile(venutian_binary, path)

Profiles a program with no extra command-line arguments and returns its parsed rows directly, this module's simplest end-to-end entry point for profiling.

rows = run_profile("bin/venutian", "stdlib/tests/fixtures/vdebugger_profile.ven")
print length(rows)

run_profile_with_args(venutian_binary, path, extra_args)

Profiles a program, forwarding extra_args to the profiled process itself, and returns its parsed rows.

rows = run_profile_with_args("bin/venutian", "examples/loop.ven", ["10000"])
print length(rows)

total_profiled_time(rows)

The combined "total_time" across every row, the denominator used for every percentage with_percentage_of computes.

print total_profiled_time(rows)

top_n_by_time(rows, n)

The n rows with the greatest "total_time", ranked descending.

slowest_two = top_n_by_time(rows, 2)
print map_get(slowest_two[0], "name")

with_percentage(rows)

Annotates every row with its share of the combined "total_time".

pct = with_percentage(rows)
print map_get(pct[0], "percentage")

with_percentage_of(row, total)

A copy of row with its share of total added as "percentage".

annotated = with_percentage_of(rows[0], total_profiled_time(rows))
print map_get(annotated, "percentage")

Get notified when vdebugger changes

Get notified about

New versions and security advisories.

New and updated packages, once a day.

News on the math model built in Venutian.