Skip to content

Commit

Permalink
dump source_version_command metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
kubkon committed Jan 7, 2024
1 parent 3705925 commit eee570c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/ZachO.zig
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ pub fn printLoadCommands(self: ZachO, writer: anytype) !void {
.DYLD_ENVIRONMENT,
=> try printDylinkerLC(fmt, lc, writer),
.MAIN => try printEntryPointLC(fmt, lc, writer),
.SOURCE_VERSION => try printSourceVersionLC(fmt, lc, writer),
else => {},
}

Expand All @@ -206,6 +207,11 @@ fn printGenericLC(f: anytype, lc: macho.LoadCommandIterator.LoadCommand, writer:
try writer.print(f.fmt("x"), .{ "Command size:", lc.cmdsize() });
}

fn printSourceVersionLC(f: anytype, lc: macho.LoadCommandIterator.LoadCommand, writer: anytype) !void {
const cmd = lc.cast(macho.source_version_command).?;
try writer.print(f.fmt("d"), .{ "Version:", cmd.version });
}

fn printDylinkerLC(f: anytype, lc: macho.LoadCommandIterator.LoadCommand, writer: anytype) !void {
const cmd = lc.cast(macho.dylinker_command).?;
const data = lc.data[cmd.name..];
Expand Down

0 comments on commit eee570c

Please sign in to comment.