feature. See also
. The project being documented here (as the example) is the Zig library itself.
Info.load
pub fn load(
gpa: Allocator,
io: Io,
path: Path,
coverage: *Coverage,
format: std.Target.ObjectFormat,
arch: std.Target.Cpu.Arch,
) LoadError!Info
File
Code
pub fn load(
gpa: Allocator,
io: Io,
path: Path,
coverage: *Coverage,
format: std.Target.ObjectFormat,
arch: std.Target.Cpu.Arch,
) LoadError!Info {
switch (format) {
.elf => {
var file = try path.root_dir.handle.openFile(io, path.sub_path, .{});
defer file.close(io);
var elf_file: ElfFile = try .load(gpa, io, file, null, &.none);
errdefer elf_file.deinit(gpa);
if (elf_file.dwarf == null) return error.MissingDebugInfo;
try elf_file.dwarf.?.open(gpa, elf_file.endian);
try elf_file.dwarf.?.populateRanges(gpa, elf_file.endian);
return .{
.impl = .{ .elf = elf_file },
.coverage = coverage,
};
},
.macho => {
const path_str = try path.toString(gpa);
defer gpa.free(path_str);
var macho_file: MachOFile = try .load(gpa, io, path_str, arch);
errdefer macho_file.deinit(gpa);
return .{
.impl = .{ .macho = macho_file },
.coverage = coverage,
};
},
else => return error.UnsupportedDebugInfo,
}
}