| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <html> |
| <!-- Copyright (C) 1988-2015 Free Software Foundation, Inc. |
| |
| Permission is granted to copy, distribute and/or modify this document |
| under the terms of the GNU Free Documentation License, Version 1.3 or |
| any later version published by the Free Software Foundation; with the |
| Invariant Sections being "Free Software" and "Free Software Needs |
| Free Documentation", with the Front-Cover Texts being "A GNU Manual," |
| and with the Back-Cover Texts as in (a) below. |
| |
| (a) The FSF's Back-Cover Text is: "You are free to copy and modify |
| this GNU Manual. Buying copies from GNU Press supports the FSF in |
| developing GNU and promoting software freedom." --> |
| <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ --> |
| <head> |
| <title>Debugging with GDB: Caching Target Data</title> |
| |
| <meta name="description" content="Debugging with GDB: Caching Target Data"> |
| <meta name="keywords" content="Debugging with GDB: Caching Target Data"> |
| <meta name="resource-type" content="document"> |
| <meta name="distribution" content="global"> |
| <meta name="Generator" content="makeinfo"> |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| <link href="index.html#Top" rel="start" title="Top"> |
| <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index"> |
| <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> |
| <link href="Data.html#Data" rel="up" title="Data"> |
| <link href="Searching-Memory.html#Searching-Memory" rel="next" title="Searching Memory"> |
| <link href="Character-Sets.html#Character-Sets" rel="prev" title="Character Sets"> |
| <style type="text/css"> |
| <!-- |
| a.summary-letter {text-decoration: none} |
| blockquote.smallquotation {font-size: smaller} |
| div.display {margin-left: 3.2em} |
| div.example {margin-left: 3.2em} |
| div.indentedblock {margin-left: 3.2em} |
| div.lisp {margin-left: 3.2em} |
| div.smalldisplay {margin-left: 3.2em} |
| div.smallexample {margin-left: 3.2em} |
| div.smallindentedblock {margin-left: 3.2em; font-size: smaller} |
| div.smalllisp {margin-left: 3.2em} |
| kbd {font-style:oblique} |
| pre.display {font-family: inherit} |
| pre.format {font-family: inherit} |
| pre.menu-comment {font-family: serif} |
| pre.menu-preformatted {font-family: serif} |
| pre.smalldisplay {font-family: inherit; font-size: smaller} |
| pre.smallexample {font-size: smaller} |
| pre.smallformat {font-family: inherit; font-size: smaller} |
| pre.smalllisp {font-size: smaller} |
| span.nocodebreak {white-space:nowrap} |
| span.nolinebreak {white-space:nowrap} |
| span.roman {font-family:serif; font-weight:normal} |
| span.sansserif {font-family:sans-serif; font-weight:normal} |
| ul.no-bullet {list-style: none} |
| --> |
| </style> |
| |
| |
| </head> |
| |
| <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> |
| <a name="Caching-Target-Data"></a> |
| <div class="header"> |
| <p> |
| Next: <a href="Searching-Memory.html#Searching-Memory" accesskey="n" rel="next">Searching Memory</a>, Previous: <a href="Character-Sets.html#Character-Sets" accesskey="p" rel="prev">Character Sets</a>, Up: <a href="Data.html#Data" accesskey="u" rel="up">Data</a> [<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> |
| </div> |
| <hr> |
| <a name="Caching-Data-of-Targets"></a> |
| <h3 class="section">10.21 Caching Data of Targets</h3> |
| <a name="index-caching-data-of-targets"></a> |
| |
| <p><small>GDB</small> caches data exchanged between the debugger and a target. |
| Each cache is associated with the address space of the inferior. |
| See <a href="Inferiors-and-Programs.html#Inferiors-and-Programs">Inferiors and Programs</a>, about inferior and address space. |
| Such caching generally improves performance in remote debugging |
| (see <a href="Remote-Debugging.html#Remote-Debugging">Remote Debugging</a>), because it reduces the overhead of the |
| remote protocol by bundling memory reads and writes into large chunks. |
| Unfortunately, simply caching everything would lead to incorrect results, |
| since <small>GDB</small> does not necessarily know anything about volatile |
| values, memory-mapped I/O addresses, etc. Furthermore, in non-stop mode |
| (see <a href="Non_002dStop-Mode.html#Non_002dStop-Mode">Non-Stop Mode</a>) memory can be changed <em>while</em> a gdb command |
| is executing. |
| Therefore, by default, <small>GDB</small> only caches data |
| known to be on the stack<a name="DOCF12" href="#FOOT12"><sup>12</sup></a> or |
| in the code segment. |
| Other regions of memory can be explicitly marked as |
| cacheable; see <a href="Memory-Region-Attributes.html#Memory-Region-Attributes">Memory Region Attributes</a>. |
| </p> |
| <dl compact="compact"> |
| <dd><a name="index-set-remotecache"></a> |
| </dd> |
| <dt><code>set remotecache on</code></dt> |
| <dt><code>set remotecache off</code></dt> |
| <dd><p>This option no longer does anything; it exists for compatibility |
| with old scripts. |
| </p> |
| <a name="index-show-remotecache"></a> |
| </dd> |
| <dt><code>show remotecache</code></dt> |
| <dd><p>Show the current state of the obsolete remotecache flag. |
| </p> |
| <a name="index-set-stack_002dcache"></a> |
| </dd> |
| <dt><code>set stack-cache on</code></dt> |
| <dt><code>set stack-cache off</code></dt> |
| <dd><p>Enable or disable caching of stack accesses. When <code>on</code>, use |
| caching. By default, this option is <code>on</code>. |
| </p> |
| <a name="index-show-stack_002dcache"></a> |
| </dd> |
| <dt><code>show stack-cache</code></dt> |
| <dd><p>Show the current state of data caching for memory accesses. |
| </p> |
| <a name="index-set-code_002dcache"></a> |
| </dd> |
| <dt><code>set code-cache on</code></dt> |
| <dt><code>set code-cache off</code></dt> |
| <dd><p>Enable or disable caching of code segment accesses. When <code>on</code>, |
| use caching. By default, this option is <code>on</code>. This improves |
| performance of disassembly in remote debugging. |
| </p> |
| <a name="index-show-code_002dcache"></a> |
| </dd> |
| <dt><code>show code-cache</code></dt> |
| <dd><p>Show the current state of target memory cache for code segment |
| accesses. |
| </p> |
| <a name="index-info-dcache"></a> |
| </dd> |
| <dt><code>info dcache <span class="roman">[</span>line<span class="roman">]</span></code></dt> |
| <dd><p>Print the information about the performance of data cache of the |
| current inferior’s address space. The information displayed |
| includes the dcache width and depth, and for each cache line, its |
| number, address, and how many times it was referenced. This |
| command is useful for debugging the data cache operation. |
| </p> |
| <p>If a line number is specified, the contents of that line will be |
| printed in hex. |
| </p> |
| </dd> |
| <dt><code>set dcache size <var>size</var></code></dt> |
| <dd><a name="index-dcache-size"></a> |
| <a name="index-set-dcache-size"></a> |
| <p>Set maximum number of entries in dcache (dcache depth above). |
| </p> |
| </dd> |
| <dt><code>set dcache line-size <var>line-size</var></code></dt> |
| <dd><a name="index-dcache-line_002dsize"></a> |
| <a name="index-set-dcache-line_002dsize"></a> |
| <p>Set number of bytes each dcache entry caches (dcache width above). |
| Must be a power of 2. |
| </p> |
| </dd> |
| <dt><code>show dcache size</code></dt> |
| <dd><a name="index-show-dcache-size"></a> |
| <p>Show maximum number of dcache entries. See <a href="#Caching-Target-Data">info dcache</a>. |
| </p> |
| </dd> |
| <dt><code>show dcache line-size</code></dt> |
| <dd><a name="index-show-dcache-line_002dsize"></a> |
| <p>Show default size of dcache lines. |
| </p> |
| </dd> |
| </dl> |
| |
| <div class="footnote"> |
| <hr> |
| <h4 class="footnotes-heading">Footnotes</h4> |
| |
| <h3><a name="FOOT12" href="#DOCF12">(12)</a></h3> |
| <p>In non-stop mode, it is moderately |
| rare for a running thread to modify the stack of a stopped thread |
| in a way that would interfere with a backtrace, and caching of |
| stack reads provides a significant speed up of remote backtraces.</p> |
| </div> |
| <hr> |
| <div class="header"> |
| <p> |
| Next: <a href="Searching-Memory.html#Searching-Memory" accesskey="n" rel="next">Searching Memory</a>, Previous: <a href="Character-Sets.html#Character-Sets" accesskey="p" rel="prev">Character Sets</a>, Up: <a href="Data.html#Data" accesskey="u" rel="up">Data</a> [<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> |
| </div> |
| |
| |
| |
| </body> |
| </html> |