Memory-Region-Attributes.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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 5.1, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <title>Debugging with GDB: Memory Region Attributes</title>
  16. <meta name="description" content="Debugging with GDB: Memory Region Attributes">
  17. <meta name="keywords" content="Debugging with GDB: Memory Region Attributes">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  21. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  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="Dump_002fRestore-Files.html#Dump_002fRestore-Files" rel="next" title="Dump/Restore Files">
  27. <link href="OS-Information.html#OS-Information" rel="previous" title="OS Information">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.smallquotation {font-size: smaller}
  32. div.display {margin-left: 3.2em}
  33. div.example {margin-left: 3.2em}
  34. div.indentedblock {margin-left: 3.2em}
  35. div.lisp {margin-left: 3.2em}
  36. div.smalldisplay {margin-left: 3.2em}
  37. div.smallexample {margin-left: 3.2em}
  38. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  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.nocodebreak {white-space:nowrap}
  50. span.nolinebreak {white-space:nowrap}
  51. span.roman {font-family:serif; font-weight:normal}
  52. span.sansserif {font-family:sans-serif; font-weight:normal}
  53. ul.no-bullet {list-style: none}
  54. -->
  55. </style>
  56. </head>
  57. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  58. <a name="Memory-Region-Attributes"></a>
  59. <div class="header">
  60. <p>
  61. Next: <a href="Dump_002fRestore-Files.html#Dump_002fRestore-Files" accesskey="n" rel="next">Dump/Restore Files</a>, Previous: <a href="OS-Information.html#OS-Information" accesskey="p" rel="previous">OS Information</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>
  62. </div>
  63. <hr>
  64. <a name="Memory-Region-Attributes-1"></a>
  65. <h3 class="section">10.17 Memory Region Attributes</h3>
  66. <a name="index-memory-region-attributes"></a>
  67. <p><em>Memory region attributes</em> allow you to describe special handling
  68. required by regions of your target&rsquo;s memory. <small>GDB</small> uses
  69. attributes to determine whether to allow certain types of memory
  70. accesses; whether to use specific width accesses; and whether to cache
  71. target memory. By default the description of memory regions is
  72. fetched from the target (if the current target supports this), but the
  73. user can override the fetched regions.
  74. </p>
  75. <p>Defined memory regions can be individually enabled and disabled. When a
  76. memory region is disabled, <small>GDB</small> uses the default attributes when
  77. accessing memory in that region. Similarly, if no memory regions have
  78. been defined, <small>GDB</small> uses the default attributes when accessing
  79. all memory.
  80. </p>
  81. <p>When a memory region is defined, it is given a number to identify it;
  82. to enable, disable, or remove a memory region, you specify that number.
  83. </p>
  84. <dl compact="compact">
  85. <dd><a name="index-mem"></a>
  86. </dd>
  87. <dt><code>mem <var>lower</var> <var>upper</var> <var>attributes</var>&hellip;</code></dt>
  88. <dd><p>Define a memory region bounded by <var>lower</var> and <var>upper</var> with
  89. attributes <var>attributes</var>&hellip;, and add it to the list of regions
  90. monitored by <small>GDB</small>. Note that <var>upper</var> == 0 is a special
  91. case: it is treated as the target&rsquo;s maximum memory address.
  92. (0xffff on 16 bit targets, 0xffffffff on 32 bit targets, etc.)
  93. </p>
  94. </dd>
  95. <dt><code>mem auto</code></dt>
  96. <dd><p>Discard any user changes to the memory regions and use target-supplied
  97. regions, if available, or no regions if the target does not support.
  98. </p>
  99. <a name="index-delete-mem"></a>
  100. </dd>
  101. <dt><code>delete mem <var>nums</var>&hellip;</code></dt>
  102. <dd><p>Remove memory regions <var>nums</var>&hellip; from the list of regions
  103. monitored by <small>GDB</small>.
  104. </p>
  105. <a name="index-disable-mem"></a>
  106. </dd>
  107. <dt><code>disable mem <var>nums</var>&hellip;</code></dt>
  108. <dd><p>Disable monitoring of memory regions <var>nums</var>&hellip;.
  109. A disabled memory region is not forgotten.
  110. It may be enabled again later.
  111. </p>
  112. <a name="index-enable-mem"></a>
  113. </dd>
  114. <dt><code>enable mem <var>nums</var>&hellip;</code></dt>
  115. <dd><p>Enable monitoring of memory regions <var>nums</var>&hellip;.
  116. </p>
  117. <a name="index-info-mem"></a>
  118. </dd>
  119. <dt><code>info mem</code></dt>
  120. <dd><p>Print a table of all defined memory regions, with the following columns
  121. for each region:
  122. </p>
  123. <dl compact="compact">
  124. <dt><em>Memory Region Number</em></dt>
  125. <dt><em>Enabled or Disabled.</em></dt>
  126. <dd><p>Enabled memory regions are marked with &lsquo;<samp>y</samp>&rsquo;.
  127. Disabled memory regions are marked with &lsquo;<samp>n</samp>&rsquo;.
  128. </p>
  129. </dd>
  130. <dt><em>Lo Address</em></dt>
  131. <dd><p>The address defining the inclusive lower bound of the memory region.
  132. </p>
  133. </dd>
  134. <dt><em>Hi Address</em></dt>
  135. <dd><p>The address defining the exclusive upper bound of the memory region.
  136. </p>
  137. </dd>
  138. <dt><em>Attributes</em></dt>
  139. <dd><p>The list of attributes set for this memory region.
  140. </p></dd>
  141. </dl>
  142. </dd>
  143. </dl>
  144. <a name="Attributes"></a>
  145. <h4 class="subsection">10.17.1 Attributes</h4>
  146. <a name="Memory-Access-Mode"></a>
  147. <h4 class="subsubsection">10.17.1.1 Memory Access Mode</h4>
  148. <p>The access mode attributes set whether <small>GDB</small> may make read or
  149. write accesses to a memory region.
  150. </p>
  151. <p>While these attributes prevent <small>GDB</small> from performing invalid
  152. memory accesses, they do nothing to prevent the target system, I/O DMA,
  153. etc. from accessing memory.
  154. </p>
  155. <dl compact="compact">
  156. <dt><code>ro</code></dt>
  157. <dd><p>Memory is read only.
  158. </p></dd>
  159. <dt><code>wo</code></dt>
  160. <dd><p>Memory is write only.
  161. </p></dd>
  162. <dt><code>rw</code></dt>
  163. <dd><p>Memory is read/write. This is the default.
  164. </p></dd>
  165. </dl>
  166. <a name="Memory-Access-Size"></a>
  167. <h4 class="subsubsection">10.17.1.2 Memory Access Size</h4>
  168. <p>The access size attribute tells <small>GDB</small> to use specific sized
  169. accesses in the memory region. Often memory mapped device registers
  170. require specific sized accesses. If no access size attribute is
  171. specified, <small>GDB</small> may use accesses of any size.
  172. </p>
  173. <dl compact="compact">
  174. <dt><code>8</code></dt>
  175. <dd><p>Use 8 bit memory accesses.
  176. </p></dd>
  177. <dt><code>16</code></dt>
  178. <dd><p>Use 16 bit memory accesses.
  179. </p></dd>
  180. <dt><code>32</code></dt>
  181. <dd><p>Use 32 bit memory accesses.
  182. </p></dd>
  183. <dt><code>64</code></dt>
  184. <dd><p>Use 64 bit memory accesses.
  185. </p></dd>
  186. </dl>
  187. <a name="Data-Cache"></a>
  188. <h4 class="subsubsection">10.17.1.3 Data Cache</h4>
  189. <p>The data cache attributes set whether <small>GDB</small> will cache target
  190. memory. While this generally improves performance by reducing debug
  191. protocol overhead, it can lead to incorrect results because <small>GDB</small>
  192. does not know about volatile variables or memory mapped device
  193. registers.
  194. </p>
  195. <dl compact="compact">
  196. <dt><code>cache</code></dt>
  197. <dd><p>Enable <small>GDB</small> to cache target memory.
  198. </p></dd>
  199. <dt><code>nocache</code></dt>
  200. <dd><p>Disable <small>GDB</small> from caching target memory. This is the default.
  201. </p></dd>
  202. </dl>
  203. <a name="Memory-Access-Checking"></a>
  204. <h4 class="subsection">10.17.2 Memory Access Checking</h4>
  205. <p><small>GDB</small> can be instructed to refuse accesses to memory that is
  206. not explicitly described. This can be useful if accessing such
  207. regions has undesired effects for a specific target, or to provide
  208. better error checking. The following commands control this behaviour.
  209. </p>
  210. <dl compact="compact">
  211. <dd><a name="index-set-mem-inaccessible_002dby_002ddefault"></a>
  212. </dd>
  213. <dt><code>set mem inaccessible-by-default [on|off]</code></dt>
  214. <dd><p>If <code>on</code> is specified, make <small>GDB</small> treat memory not
  215. explicitly described by the memory ranges as non-existent and refuse accesses
  216. to such memory. The checks are only performed if there&rsquo;s at least one
  217. memory range defined. If <code>off</code> is specified, make <small>GDB</small>
  218. treat the memory not explicitly described by the memory ranges as RAM.
  219. The default value is <code>on</code>.
  220. <a name="index-show-mem-inaccessible_002dby_002ddefault"></a>
  221. </p></dd>
  222. <dt><code>show mem inaccessible-by-default</code></dt>
  223. <dd><p>Show the current handling of accesses to unknown memory.
  224. </p></dd>
  225. </dl>
  226. <hr>
  227. <div class="header">
  228. <p>
  229. Next: <a href="Dump_002fRestore-Files.html#Dump_002fRestore-Files" accesskey="n" rel="next">Dump/Restore Files</a>, Previous: <a href="OS-Information.html#OS-Information" accesskey="p" rel="previous">OS Information</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>
  230. </div>
  231. </body>
  232. </html>