Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ def complete_symbol(
help="""Diff .o files rather than a whole binary. This makes it possible to
see symbol names. (Recommended)""",
)
parser.add_argument(
"--objsym",
dest="diff_obj_symbol",
metavar="SYMBOL",
help="""Diff a specific function in two .o files, both non-stripped.""",
)
parser.add_argument(
"-f",
"--file",
Expand Down Expand Up @@ -1522,7 +1528,7 @@ def dump_elf(


def dump_objfile(
start: str, end: Optional[str], config: Config, project: ProjectSettings
start: str, end: Optional[str], diff_obj_symbol: str, config: Config, project: ProjectSettings
) -> Tuple[str, ObjdumpCommand, ObjdumpCommand]:
if config.base_shift:
fail("--base-shift not compatible with -o")
Expand Down Expand Up @@ -1550,6 +1556,8 @@ def dump_objfile(

if project.disassemble_all:
disassemble_flag = "-D"
elif diff_obj_symbol:
disassemble_flag = f"--disassemble={diff_obj_symbol}"
else:
disassemble_flag = "-d"

Expand Down Expand Up @@ -3772,7 +3780,7 @@ def main() -> None:
)
elif config.diff_obj:
make_target, basecmd, mycmd = dump_objfile(
args.start, args.end, config, project
args.start, args.end, args.diff_obj_symbol, config, project
)
else:
make_target, basecmd, mycmd = dump_binary(args.start, args.end, config, project)
Expand Down