← 返回命令列表

Linux command

codiff 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Diff two object files

codiff [old.o] [new.o]

Only show struct changes

codiff -s [old.o] [new.o]

Only show function changes

codiff -f [old.o] [new.o]

Print terse type changes

codiff -t [old.o] [new.o]

Verbose output

codiff -V [old.o] [new.o]

Quiet mode

codiff -q [old.o] [new.o]

说明

codiff compares the DWARF (or CTF/BTF) debugging information embedded in two ELF object files and reports the differences in C-level types, structures, and function prototypes. It is part of the dwarves suite alongside pahole, pfunct, pglobal, and pdwtags. The typical use case is verifying the impact of a patch on a kernel module, library, or large binary: a developer compiles the same translation unit before and after a change and runs codiff to see which structures grew, which fields moved, and which exported functions had their signatures altered. Because the comparison is structural rather than textual, renames of unrelated symbols and reordering of unrelated declarations are filtered out automatically. Without -s or -f, both struct and function diffs are produced. The tool requires the input files to be built with debugging information (-g for GCC/Clang).

参数

-s, --structs
Show diffs of struct/union/class definitions: added, removed, resized, or re-arranged members.
-f, --functions
Show diffs of function signatures and prototypes: parameter or return-type changes, additions, removals.
-t, --terse_type_changes
Print a compact summary line for each changed type instead of the full breakdown.
-V, --verbose
Verbose output: show offsets, sizes, alignment, and per-member changes for each affected type.
-q, --quiet
Only set the exit status; suppress all output. Useful for scripts.
-F _list_, --format_path _list_
Comma-separated list of debug formats to try in order (e.g. dwarf, ctf, btf).
--help
Print help text and exit.

FAQ

What is the codiff command used for?

codiff compares the DWARF (or CTF/BTF) debugging information embedded in two ELF object files and reports the differences in C-level types, structures, and function prototypes. It is part of the dwarves suite alongside pahole, pfunct, pglobal, and pdwtags. The typical use case is verifying the impact of a patch on a kernel module, library, or large binary: a developer compiles the same translation unit before and after a change and runs codiff to see which structures grew, which fields moved, and which exported functions had their signatures altered. Because the comparison is structural rather than textual, renames of unrelated symbols and reordering of unrelated declarations are filtered out automatically. Without -s or -f, both struct and function diffs are produced. The tool requires the input files to be built with debugging information (-g for GCC/Clang).

How do I run a basic codiff example?

Run `codiff [old.o] [new.o]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -s, --structs do in codiff?

Show diffs of struct/union/class definitions: added, removed, resized, or re-arranged members.