Debugging utilities (#860)

* add debug printing for Ast and DocumentScope

* add optional failing allocator
This commit is contained in:
Techatrix
2022-12-30 23:42:53 +00:00
committed by GitHub
parent f473088b64
commit 94ec3a0a86
5 changed files with 155 additions and 26 deletions

View File

@@ -49,6 +49,18 @@ pub fn build(b: *std.build.Builder) !void {
"enable_tracy_callstack",
b.option(bool, "enable_tracy_callstack", "Enable callstack graphs.") orelse false,
);
exe_options.addOption(
bool,
"enable_failing_allocator",
b.option(bool, "enable_failing_allocator", "Whether to use a randomly failing allocator.") orelse false,
);
exe_options.addOption(
u32,
"enable_failing_allocator_likelihood",
b.option(u32, "enable_failing_allocator_likelihood", "The chance that an allocation will fail is `1/likelihood`") orelse 256,
);
const version = v: {
const version_string = b.fmt("{d}.{d}.{d}", .{ zls_version.major, zls_version.minor, zls_version.patch });