BINPATCH(8) | System Manager's Manual (atari) | BINPATCH(8)

# NAME

`binpatch` — examine and or modify initialized data in an executable binary

# SYNOPSIS

`binpatch` | [`-b` | `-w` | `-l` | `-d`] [`-o` offset] [`-T` saddr] `-s` symname [`-r` value] binfile

`binpatch` | [`-b` | `-w` | `-l` | `-d`] [`-o` offset] [`-T` saddr] `-a` addr [`-r` value] binfile

# DESCRIPTION

`binpatch` is used to modify or examine the data associated with a symbol in a binary file binfile.

The flags `-b`, `-w`, `-l`, and `-d` specify the size of the data to be modified or examined. `-b` is for 8bit (`int8_t`), `-w` is for 16bit (`int16_t`), `-l` is for 32bit (`int32_t`), and `-d` is for 64bit (`int64_t`) variables.

The binfile is scanned in search of the symbol symname (specified with the `-s` flag). If the symbol is found the current data and address are printed.

Next if the `-r` flag has been given, the current data is replaced with that of value.

If the second form is used the address addr specified with the `-a` flag is used as a direct address into the data section of the binary and no symbol search is performed.

The `-o` flag specifies an offset in `int8_t`, `int16_t`, `int32_t`, and `int64_t` (`-b`, `-w`, `-l`, or `-d`) units from the given locator (`-s` or `-a`) for `binpatch` to perform its described actions. This might be useful to patch a member of array or structure.

The `-T` flag is used to specify the starting address of a.out binary text segment. Ignored for other binary executable formats.

# SEE ALSO

gdb(1), mdsetimage(8)

# BUGS

The `binpatch` command doesn't check if size of specified symbol is the same as the specified size by `-b`, `-w`, `-l`, or `-d` flag.

The `binpatch` command doesn't check if specified address or symbol is a patchable variable and it might corrupt the specified executable binary.

August 20, 2009 | NetBSD 11.99