Files
reverse-engineering-anything/src/objdump/ObjdumpCommand.ts
T
gensokyo-dev 17f581ff75 perf(reverse): add retained GDB and objdump summaries (#5614)
Add opt-in retained GDB and objdump summaries using the shared analysis-view layer. Preserve default complete Evidence, ordered records, provenance and completion facts.

Validate real Bash disassembly, whole-client context costs, CLI publication and cleanup; retain the original measured cohorts and explicit coverage limitations.

Closes #5584.
2026-10-21 01:20:52 +08:00

30 lines
1.0 KiB
TypeScript

import type { ObjdumpSelection } 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: ObjdumpSelection): 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),
];
};