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.

Overlay-Commands.html 9.3KB

пре 3 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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>Overlay Commands (Debugging with GDB)</title>
  17. <meta name="description" content="Overlay Commands (Debugging with GDB)">
  18. <meta name="keywords" content="Overlay Commands (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="Overlays.html#Overlays" rel="up" title="Overlays">
  26. <link href="Automatic-Overlay-Debugging.html#Automatic-Overlay-Debugging" rel="next" title="Automatic Overlay Debugging">
  27. <link href="How-Overlays-Work.html#How-Overlays-Work" rel="prev" title="How Overlays Work">
  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="Overlay-Commands"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="Automatic-Overlay-Debugging.html#Automatic-Overlay-Debugging" accesskey="n" rel="next">Automatic Overlay Debugging</a>, Previous: <a href="How-Overlays-Work.html#How-Overlays-Work" accesskey="p" rel="prev">How Overlays Work</a>, Up: <a href="Overlays.html#Overlays" accesskey="u" rel="up">Overlays</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="Overlay-Commands-1"></a>
  64. <h3 class="section">14.2 Overlay Commands</h3>
  65. <p>To use <small>GDB</small>&rsquo;s overlay support, each overlay in your program must
  66. correspond to a separate section of the executable file. The section&rsquo;s
  67. virtual memory address and load memory address must be the overlay&rsquo;s
  68. mapped and load addresses. Identifying overlays with sections allows
  69. <small>GDB</small> to determine the appropriate address of a function or
  70. variable, depending on whether the overlay is mapped or not.
  71. </p>
  72. <p><small>GDB</small>&rsquo;s overlay commands all start with the word <code>overlay</code>;
  73. you can abbreviate this as <code>ov</code> or <code>ovly</code>. The commands are:
  74. </p>
  75. <dl compact="compact">
  76. <dt><code>overlay off</code></dt>
  77. <dd><a name="index-overlay"></a>
  78. <p>Disable <small>GDB</small>&rsquo;s overlay support. When overlay support is
  79. disabled, <small>GDB</small> assumes that all functions and variables are
  80. always present at their mapped addresses. By default, <small>GDB</small>&rsquo;s
  81. overlay support is disabled.
  82. </p>
  83. </dd>
  84. <dt><code>overlay manual</code></dt>
  85. <dd><a name="index-manual-overlay-debugging"></a>
  86. <p>Enable <em>manual</em> overlay debugging. In this mode, <small>GDB</small>
  87. relies on you to tell it which overlays are mapped, and which are not,
  88. using the <code>overlay map-overlay</code> and <code>overlay unmap-overlay</code>
  89. commands described below.
  90. </p>
  91. </dd>
  92. <dt><code>overlay map-overlay <var>overlay</var></code></dt>
  93. <dt><code>overlay map <var>overlay</var></code></dt>
  94. <dd><a name="index-map-an-overlay"></a>
  95. <p>Tell <small>GDB</small> that <var>overlay</var> is now mapped; <var>overlay</var> must
  96. be the name of the object file section containing the overlay. When an
  97. overlay is mapped, <small>GDB</small> assumes it can find the overlay&rsquo;s
  98. functions and variables at their mapped addresses. <small>GDB</small> assumes
  99. that any other overlays whose mapped ranges overlap that of
  100. <var>overlay</var> are now unmapped.
  101. </p>
  102. </dd>
  103. <dt><code>overlay unmap-overlay <var>overlay</var></code></dt>
  104. <dt><code>overlay unmap <var>overlay</var></code></dt>
  105. <dd><a name="index-unmap-an-overlay"></a>
  106. <p>Tell <small>GDB</small> that <var>overlay</var> is no longer mapped; <var>overlay</var>
  107. must be the name of the object file section containing the overlay.
  108. When an overlay is unmapped, <small>GDB</small> assumes it can find the
  109. overlay&rsquo;s functions and variables at their load addresses.
  110. </p>
  111. </dd>
  112. <dt><code>overlay auto</code></dt>
  113. <dd><p>Enable <em>automatic</em> overlay debugging. In this mode, <small>GDB</small>
  114. consults a data structure the overlay manager maintains in the inferior
  115. to see which overlays are mapped. For details, see <a href="Automatic-Overlay-Debugging.html#Automatic-Overlay-Debugging">Automatic Overlay Debugging</a>.
  116. </p>
  117. </dd>
  118. <dt><code>overlay load-target</code></dt>
  119. <dt><code>overlay load</code></dt>
  120. <dd><a name="index-reloading-the-overlay-table"></a>
  121. <p>Re-read the overlay table from the inferior. Normally, <small>GDB</small>
  122. re-reads the table <small>GDB</small> automatically each time the inferior
  123. stops, so this command should only be necessary if you have changed the
  124. overlay mapping yourself using <small>GDB</small>. This command is only
  125. useful when using automatic overlay debugging.
  126. </p>
  127. </dd>
  128. <dt><code>overlay list-overlays</code></dt>
  129. <dt><code>overlay list</code></dt>
  130. <dd><a name="index-listing-mapped-overlays"></a>
  131. <p>Display a list of the overlays currently mapped, along with their mapped
  132. addresses, load addresses, and sizes.
  133. </p>
  134. </dd>
  135. </dl>
  136. <p>Normally, when <small>GDB</small> prints a code address, it includes the name
  137. of the function the address falls in:
  138. </p>
  139. <div class="smallexample">
  140. <pre class="smallexample">(gdb) print main
  141. $3 = {int ()} 0x11a0 &lt;main&gt;
  142. </pre></div>
  143. <p>When overlay debugging is enabled, <small>GDB</small> recognizes code in
  144. unmapped overlays, and prints the names of unmapped functions with
  145. asterisks around them. For example, if <code>foo</code> is a function in an
  146. unmapped overlay, <small>GDB</small> prints it this way:
  147. </p>
  148. <div class="smallexample">
  149. <pre class="smallexample">(gdb) overlay list
  150. No sections are mapped.
  151. (gdb) print foo
  152. $5 = {int (int)} 0x100000 &lt;*foo*&gt;
  153. </pre></div>
  154. <p>When <code>foo</code>&rsquo;s overlay is mapped, <small>GDB</small> prints the function&rsquo;s
  155. name normally:
  156. </p>
  157. <div class="smallexample">
  158. <pre class="smallexample">(gdb) overlay list
  159. Section .ov.foo.text, loaded at 0x100000 - 0x100034,
  160. mapped at 0x1016 - 0x104a
  161. (gdb) print foo
  162. $6 = {int (int)} 0x1016 &lt;foo&gt;
  163. </pre></div>
  164. <p>When overlay debugging is enabled, <small>GDB</small> can find the correct
  165. address for functions and variables in an overlay, whether or not the
  166. overlay is mapped. This allows most <small>GDB</small> commands, like
  167. <code>break</code> and <code>disassemble</code>, to work normally, even on unmapped
  168. code. However, <small>GDB</small>&rsquo;s breakpoint support has some limitations:
  169. </p>
  170. <ul>
  171. <li> <a name="index-breakpoints-in-overlays"></a>
  172. <a name="index-overlays_002c-setting-breakpoints-in"></a>
  173. You can set breakpoints in functions in unmapped overlays, as long as
  174. <small>GDB</small> can write to the overlay at its load address.
  175. </li><li> <small>GDB</small> can not set hardware or simulator-based breakpoints in
  176. unmapped overlays. However, if you set a breakpoint at the end of your
  177. overlay manager (and tell <small>GDB</small> which overlays are now mapped, if
  178. you are using manual overlay management), <small>GDB</small> will re-set its
  179. breakpoints properly.
  180. </li></ul>
  181. <hr>
  182. <div class="header">
  183. <p>
  184. Next: <a href="Automatic-Overlay-Debugging.html#Automatic-Overlay-Debugging" accesskey="n" rel="next">Automatic Overlay Debugging</a>, Previous: <a href="How-Overlays-Work.html#How-Overlays-Work" accesskey="p" rel="prev">How Overlays Work</a>, Up: <a href="Overlays.html#Overlays" accesskey="u" rel="up">Overlays</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>
  185. </div>
  186. </body>
  187. </html>