xref: /netbsd/share/man/man8/man8.atari/binpatch.8 (revision 6550d01e)
1.\"	$NetBSD: binpatch.8,v 1.8 2009/08/24 12:55:16 tsutsui Exp $
2.\"
3.\" Copyright (c) 1994 Christian E. Hopps
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"      This product includes software developed by Christian E. Hopps.
17.\" 4. The name of the author may not be used to endorse or promote products
18.\"    derived from this software without specific prior written permission
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30.\"
31.Dd August 20, 2009
32.Dt BINPATCH 8 atari
33.Os
34.Sh NAME
35.Nm binpatch
36.Nd "examine and or modify initialized data in an executable binary"
37.Sh SYNOPSIS
38.Nm binpatch
39.Op Fl b | Fl w | Fl l | Fl d
40.Op Fl o Ar offset
41.Op Fl T Ar saddr
42.Fl s Ar symname
43.Op Fl r Ar value
44.Ar binfile
45.Nm binpatch
46.Op Fl b | Fl w | Fl l | Fl d
47.Op Fl o Ar offset
48.Op Fl T Ar saddr
49.Fl a Ar addr
50.Op Fl r Ar value
51.Ar binfile
52.Sh DESCRIPTION
53.Nm
54is used to modify or examine the data associated with a symbol in a binary
55file
56.Ar binfile .
57.Pp
58The flags
59.Fl b ,
60.Fl w ,
61.Fl l ,
62and
63.Fl d
64specify the size of the data to be modified or examined.
65.Fl b
66is for 8bit
67.Pq Li int8_t ,
68.Fl w
69is for 16bit
70.Pq Li int16_t ,
71.Fl l
72is for 32bit
73.Pq Li int32_t ,
74and
75.Fl d
76is for 64bit
77.Pq Li int64_t
78variables.
79.Pp
80The
81.Ar binfile
82is scanned in search of the symbol
83.Ar symname
84(specified with the
85.Fl s
86flag).
87If the symbol is found the current data and address are printed.
88.Pp
89Next if the
90.Fl r
91flag has been given, the current data is replaced with that of
92.Ar value .
93.Pp
94If the second form is used the address
95.Ar addr
96specified with the
97.Fl a
98flag is used as a direct address into the data section of the binary and
99no symbol search is performed.
100.Pp
101The
102.Fl o
103flag specifies an offset in
104.Li int8_t ,
105.Li int16_t ,
106.Li int32_t ,
107and
108.Li int64_t
109.Fl ( b ,
110.Fl w ,
111.Fl l ,
112or
113.Fl d )
114units from the given locator
115.Fl ( s
116or
117.Fl a )
118for
119.Nm
120to perform its described actions.
121This might be useful to patch a member of array or structure.
122.Pp
123The
124.Fl T
125flag is used to specify the starting address of a.out binary text segment.
126Ignored for other binary executable formats.
127.Sh SEE ALSO
128.Xr gdb 1 ,
129.Xr mdsetimage 8
130.Sh BUGS
131The
132.Nm
133command doesn't check if size of specified symbol is the same as the
134specified size by
135.Fl b ,
136.Fl w ,
137.Fl l ,
138or
139.Fl d
140flag.
141.Pp
142The
143.Nm
144command doesn't check if specified address or symbol is a patchable variable
145and it might corrupt the specified executable binary.
146