You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

157 lines
7.4KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Free Software" and "Free Software Needs
  8. Free Documentation", with the Front-Cover Texts being "A GNU Manual,"
  9. and with the Back-Cover Texts as in (a) below.
  10. (a) The FSF's Back-Cover Text is: "You are free to copy and modify
  11. this GNU Manual. Buying copies from GNU Press supports the FSF in
  12. developing GNU and promoting software freedom." -->
  13. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  16. <title>Dump/Restore Files (Debugging with GDB)</title>
  17. <meta name="description" content="Dump/Restore Files (Debugging with GDB)">
  18. <meta name="keywords" content="Dump/Restore Files (Debugging with GDB)">
  19. <meta name="resource-type" content="document">
  20. <meta name="distribution" content="global">
  21. <meta name="Generator" content="makeinfo">
  22. <link href="index.html#Top" rel="start" title="Top">
  23. <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
  24. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  25. <link href="Data.html#Data" rel="up" title="Data">
  26. <link href="Core-File-Generation.html#Core-File-Generation" rel="next" title="Core File Generation">
  27. <link href="Memory-Region-Attributes.html#Memory-Region-Attributes" rel="prev" title="Memory Region Attributes">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.indentedblock {margin-right: 0em}
  32. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  33. blockquote.smallquotation {font-size: smaller}
  34. div.display {margin-left: 3.2em}
  35. div.example {margin-left: 3.2em}
  36. div.lisp {margin-left: 3.2em}
  37. div.smalldisplay {margin-left: 3.2em}
  38. div.smallexample {margin-left: 3.2em}
  39. div.smalllisp {margin-left: 3.2em}
  40. kbd {font-style: oblique}
  41. pre.display {font-family: inherit}
  42. pre.format {font-family: inherit}
  43. pre.menu-comment {font-family: serif}
  44. pre.menu-preformatted {font-family: serif}
  45. pre.smalldisplay {font-family: inherit; font-size: smaller}
  46. pre.smallexample {font-size: smaller}
  47. pre.smallformat {font-family: inherit; font-size: smaller}
  48. pre.smalllisp {font-size: smaller}
  49. span.nolinebreak {white-space: nowrap}
  50. span.roman {font-family: initial; font-weight: normal}
  51. span.sansserif {font-family: sans-serif; font-weight: normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en">
  57. <a name="Dump_002fRestore-Files"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="Core-File-Generation.html#Core-File-Generation" accesskey="n" rel="next">Core File Generation</a>, Previous: <a href="Memory-Region-Attributes.html#Memory-Region-Attributes" accesskey="p" rel="prev">Memory Region Attributes</a>, Up: <a href="Data.html#Data" accesskey="u" rel="up">Data</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  61. </div>
  62. <hr>
  63. <a name="Copy-Between-Memory-and-a-File"></a>
  64. <h3 class="section">10.18 Copy Between Memory and a File</h3>
  65. <a name="index-dump_002frestore-files"></a>
  66. <a name="index-append-data-to-a-file"></a>
  67. <a name="index-dump-data-to-a-file"></a>
  68. <a name="index-restore-data-from-a-file"></a>
  69. <p>You can use the commands <code>dump</code>, <code>append</code>, and
  70. <code>restore</code> to copy data between target memory and a file. The
  71. <code>dump</code> and <code>append</code> commands write data to a file, and the
  72. <code>restore</code> command reads data from a file back into the inferior&rsquo;s
  73. memory. Files may be in binary, Motorola S-record, Intel hex,
  74. Tektronix Hex, or Verilog Hex format; however, <small>GDB</small> can only
  75. append to binary files, and cannot read from Verilog Hex files.
  76. </p>
  77. <dl compact="compact">
  78. <dd>
  79. <a name="index-dump"></a>
  80. </dd>
  81. <dt><code>dump <span class="roman">[</span><var>format</var><span class="roman">]</span> memory <var>filename</var> <var>start_addr</var> <var>end_addr</var></code></dt>
  82. <dt><code>dump <span class="roman">[</span><var>format</var><span class="roman">]</span> value <var>filename</var> <var>expr</var></code></dt>
  83. <dd><p>Dump the contents of memory from <var>start_addr</var> to <var>end_addr</var>,
  84. or the value of <var>expr</var>, to <var>filename</var> in the given format.
  85. </p>
  86. <p>The <var>format</var> parameter may be any one of:
  87. </p><dl compact="compact">
  88. <dt><code>binary</code></dt>
  89. <dd><p>Raw binary form.
  90. </p></dd>
  91. <dt><code>ihex</code></dt>
  92. <dd><p>Intel hex format.
  93. </p></dd>
  94. <dt><code>srec</code></dt>
  95. <dd><p>Motorola S-record format.
  96. </p></dd>
  97. <dt><code>tekhex</code></dt>
  98. <dd><p>Tektronix Hex format.
  99. </p></dd>
  100. <dt><code>verilog</code></dt>
  101. <dd><p>Verilog Hex format.
  102. </p></dd>
  103. </dl>
  104. <p><small>GDB</small> uses the same definitions of these formats as the
  105. <small>GNU</small> binary utilities, like &lsquo;<samp>objdump</samp>&rsquo; and &lsquo;<samp>objcopy</samp>&rsquo;. If
  106. <var>format</var> is omitted, <small>GDB</small> dumps the data in raw binary
  107. form.
  108. </p>
  109. <a name="index-append"></a>
  110. </dd>
  111. <dt><code>append <span class="roman">[</span>binary<span class="roman">]</span> memory <var>filename</var> <var>start_addr</var> <var>end_addr</var></code></dt>
  112. <dt><code>append <span class="roman">[</span>binary<span class="roman">]</span> value <var>filename</var> <var>expr</var></code></dt>
  113. <dd><p>Append the contents of memory from <var>start_addr</var> to <var>end_addr</var>,
  114. or the value of <var>expr</var>, to the file <var>filename</var>, in raw binary form.
  115. (<small>GDB</small> can only append data to files in raw binary form.)
  116. </p>
  117. <a name="index-restore"></a>
  118. </dd>
  119. <dt><code>restore <var>filename</var> <span class="roman">[</span>binary<span class="roman">]</span> <var>bias</var> <var>start</var> <var>end</var></code></dt>
  120. <dd><p>Restore the contents of file <var>filename</var> into memory. The
  121. <code>restore</code> command can automatically recognize any known <small>BFD</small>
  122. file format, except for raw binary. To restore a raw binary file you
  123. must specify the optional keyword <code>binary</code> after the filename.
  124. </p>
  125. <p>If <var>bias</var> is non-zero, its value will be added to the addresses
  126. contained in the file. Binary files always start at address zero, so
  127. they will be restored at address <var>bias</var>. Other bfd files have
  128. a built-in location; they will be restored at offset <var>bias</var>
  129. from that location.
  130. </p>
  131. <p>If <var>start</var> and/or <var>end</var> are non-zero, then only data between
  132. file offset <var>start</var> and file offset <var>end</var> will be restored.
  133. These offsets are relative to the addresses in the file, before
  134. the <var>bias</var> argument is applied.
  135. </p>
  136. </dd>
  137. </dl>
  138. <hr>
  139. <div class="header">
  140. <p>
  141. Next: <a href="Core-File-Generation.html#Core-File-Generation" accesskey="n" rel="next">Core File Generation</a>, Previous: <a href="Memory-Region-Attributes.html#Memory-Region-Attributes" accesskey="p" rel="prev">Memory Region Attributes</a>, Up: <a href="Data.html#Data" accesskey="u" rel="up">Data</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  142. </div>
  143. </body>
  144. </html>