Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / mingw / info / gdb / Patching.html
blobe85c35221c1824903b9f597354bf1a6d378fdaa9
1 <html lang="en">
2 <head>
3 <title>Debugging with GDB</title>
4 <meta http-equiv="Content-Type" content="text/html">
5 <meta name="description" content="Debugging with GDB">
6 <meta name="generator" content="makeinfo 4.3">
7 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home">
8 </head>
9 <body>
10 <div class="node">
11 <p>
12 Node:<a name="Patching">Patching</a>,
13 Previous:<a rel="previous" accesskey="p" href="Calling.html#Calling">Calling</a>,
14 Up:<a rel="up" accesskey="u" href="Altering.html#Altering">Altering</a>
15 <hr><br>
16 </div>
18 <h3 class="section">Patching programs</h3>
20 <p>By default, GDB opens the file containing your program's
21 executable code (or the corefile) read-only. This prevents accidental
22 alterations to machine code; but it also prevents you from intentionally
23 patching your program's binary.
25 <p>If you'd like to be able to patch the binary, you can specify that
26 explicitly with the <code>set write</code> command. For example, you might
27 want to turn on internal debugging flags, or even to make emergency
28 repairs.
30 <dl>
31 <dt><code>set write on</code>
32 <dd><dt><code>set write off</code>
33 <dd>If you specify <code>set write on</code>, GDB opens executable and
34 core files for both reading and writing; if you specify <code>set write
35 off</code> (the default), GDB opens them read-only.
37 <p>If you have already loaded a file, you must load it again (using the
38 <code>exec-file</code> or <code>core-file</code> command) after changing <code>set
39 write</code>, for your new setting to take effect.
41 <br><dt><code>show write</code>
42 <dd>Display whether executable files and core files are opened for writing
43 as well as reading.
44 </dl>
46 </body></html>