mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-26 13:01:34 +03:00
add objdump subcommand
does nothing so far
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
const std = @import("std");
|
||||
const Io = std.Io;
|
||||
const fatal = std.process.fatal;
|
||||
|
||||
pub fn main(init: std.process.Init) !void {
|
||||
const io = init.io;
|
||||
const args = try init.minimal.args.toSlice(init.arena.allocator());
|
||||
|
||||
var input_path: ?[]const u8 = null;
|
||||
var i: usize = 0;
|
||||
while (i < args.len) : (i += 1) {
|
||||
const arg = args[i];
|
||||
if (std.mem.startsWith(u8, arg, "-")) {
|
||||
if (std.mem.eql(u8, arg, "-h") or std.mem.eql(u8, arg, "--help")) {
|
||||
return Io.File.stdout().writeStreamingAll(io, usage);
|
||||
} else {
|
||||
fatal("unrecognized argument: {s}", .{arg});
|
||||
}
|
||||
} else if (input_path == null) {
|
||||
input_path = arg;
|
||||
} else {
|
||||
fatal("unexpected positional: {s}", .{arg});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const usage =
|
||||
\\Usage: zig objdump [options] file
|
||||
\\
|
||||
\\Options:
|
||||
\\ -h, --help Print this help and exit
|
||||
\\
|
||||
;
|
||||
+8
-2
@@ -95,13 +95,14 @@ const normal_usage =
|
||||
\\ reduce Minimize a bug report
|
||||
\\ translate-c Convert C code to Zig code
|
||||
\\
|
||||
\\ ar Use Zig as a drop-in archiver
|
||||
\\ ar Combine object files into static archive
|
||||
\\ cc Use Zig as a drop-in C compiler
|
||||
\\ c++ Use Zig as a drop-in C++ compiler
|
||||
\\ dlltool Use Zig as a drop-in dlltool.exe
|
||||
\\ lib Use Zig as a drop-in lib.exe
|
||||
\\ objcopy Manipulate executables and relocatables
|
||||
\\ objdump Print information about executables and relocatables
|
||||
\\ ranlib Use Zig as a drop-in ranlib
|
||||
\\ objcopy Use Zig as a drop-in objcopy
|
||||
\\ rc Use Zig as a drop-in rc.exe
|
||||
\\
|
||||
\\ env Print lib path, std path, cache directory, and version
|
||||
@@ -342,6 +343,11 @@ fn mainArgs(
|
||||
.cmd_name = "objcopy",
|
||||
.root_src_path = "objcopy.zig",
|
||||
});
|
||||
} else if (mem.eql(u8, cmd, "objdump")) {
|
||||
return jitCmd(gpa, arena, io, cmd_args, environ_map, .{
|
||||
.cmd_name = "objdump",
|
||||
.root_src_path = "objdump.zig",
|
||||
});
|
||||
} else if (mem.eql(u8, cmd, "fetch")) {
|
||||
return cmdFetch(gpa, arena, io, cmd_args, environ_map);
|
||||
} else if (mem.eql(u8, cmd, "libc")) {
|
||||
|
||||
Reference in New Issue
Block a user