Zig version
0.11.0-dev.3299+34865d693
The problem
I want to be able to see the assembly output of my program, ideally with file names and line numbers mapping to the assembly instructions so I can quickly reason about where they've come from.
Files in project
build.zig
const std = @import("std");
pub fn build(b: *std.Build.Builder) !void {
// Determine compilation target
const target = b.standardTargetOptions(.{});
// Setup optimisation settings
const optimize = b.standardOptimizeOption(.{});
// Create executable for our example
const exe = b.addExecutable(.{
.name = "app",
.root_source_file = .{ .path = "main.zig" },
.target = target,
.optimize = optimize,
});
// Install the executable into the prefix when invoking "zig build"
b.installArtifact(exe);
}
main.zig
const std = @import("std");
pub fn main() void {
std.debug.print("Hello, {s}!\n", .{"World"});
}