Files
rea/src/objdump/ObjdumpCommand.ts
T
gensokyo-devandKaoru0822 3ea0d9489e feat(objdump): select native disassembly by symbol (#5171)
Push optional native symbol selection into GNU objdump before collecting Evidence. Preserve native matching, raw output, artifact identity, scoped limitations and the existing full-disassembly default through the shared CLI/MCP workflow.

Fixes #5159

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
2026-10-19 20:15:20 +08:00

30 lines
1018 B
TypeScript

import type { ObjdumpInput } from "../domain/reverseEngineering.js";
import { absoluteCallerPath } from "../filesystem/callerPath.js";
export const OBJDUMP_PROVIDER_IDENTITY = {
id: "gnu.objdump",
name: "GNU objdump",
version: null,
} as const;
/** Build GNU objdump argv without invoking a shell or following DWARF links by default. */
export const objdumpCommand = (input: ObjdumpInput): readonly string[] => {
if (input.operation === "architectures") return ["-i"];
const argumentsByOperation = {
file_headers: ["-f"],
section_headers: ["-h"],
symbols: ["-t"],
relocations: ["-r"],
dwarf: ["-W", input.follow_debug_links ? "-WK" : "-WN"],
disassemble:
input.operation === "disassemble" && input.symbol !== undefined
? [`--disassemble=${input.symbol}`]
: ["-d"],
disassemble_all: ["-D"],
} satisfies Record<typeof input.operation, readonly string[]>;
return [
...argumentsByOperation[input.operation],
absoluteCallerPath(input.path),
];
};