| <html lang="en"> |
| <head> |
| <title>Caching Target Data - Debugging with GDB</title> |
| <meta http-equiv="Content-Type" content="text/html"> |
| <meta name="description" content="Debugging with GDB"> |
| <meta name="generator" content="makeinfo 4.13"> |
| <link title="Top" rel="start" href="index.html#Top"> |
| <link rel="up" href="Data.html#Data" title="Data"> |
| <link rel="prev" href="Character-Sets.html#Character-Sets" title="Character Sets"> |
| <link rel="next" href="Searching-Memory.html#Searching-Memory" title="Searching Memory"> |
| <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> |
| <!-- |
| Copyright (C) 1988-2019 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.'' |
| --> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <style type="text/css"><!-- |
| pre.display { font-family:inherit } |
| pre.format { font-family:inherit } |
| pre.smalldisplay { font-family:inherit; font-size:smaller } |
| pre.smallformat { font-family:inherit; font-size:smaller } |
| pre.smallexample { font-size:smaller } |
| pre.smalllisp { font-size:smaller } |
| span.sc { font-variant:small-caps } |
| span.roman { font-family:serif; font-weight:normal; } |
| span.sansserif { font-family:sans-serif; font-weight:normal; } |
| --></style> |
| </head> |
| <body> |
| <div class="node"> |
| <a name="Caching-Target-Data"></a> |
| <p> |
| Next: <a rel="next" accesskey="n" href="Searching-Memory.html#Searching-Memory">Searching Memory</a>, |
| Previous: <a rel="previous" accesskey="p" href="Character-Sets.html#Character-Sets">Character Sets</a>, |
| Up: <a rel="up" accesskey="u" href="Data.html#Data">Data</a> |
| <hr> |
| </div> |
| |
| <h3 class="section">10.21 Caching Data of Targets</h3> |
| |
| <p><a name="index-caching-data-of-targets-816"></a> |
| <span class="sc">gdb</span> 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 <span class="sc">gdb</span> 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, <span class="sc">gdb</span> only caches data |
| known to be on the stack<a rel="footnote" href="#fn-1" name="fnd-1"><sup>1</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>. |
| |
| |
| <a name="index-set-remotecache-817"></a> |
| <dl><dt><code>set remotecache on</code><dt><code>set remotecache off</code><dd>This option no longer does anything; it exists for compatibility |
| with old scripts. |
| |
| <p><a name="index-show-remotecache-818"></a><br><dt><code>show remotecache</code><dd>Show the current state of the obsolete remotecache flag. |
| |
| <p><a name="index-set-stack_002dcache-819"></a><br><dt><code>set stack-cache on</code><dt><code>set stack-cache off</code><dd>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-820"></a><br><dt><code>show stack-cache</code><dd>Show the current state of data caching for memory accesses. |
| |
| <p><a name="index-set-code_002dcache-821"></a><br><dt><code>set code-cache on</code><dt><code>set code-cache off</code><dd>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-822"></a><br><dt><code>show code-cache</code><dd>Show the current state of target memory cache for code segment |
| accesses. |
| |
| <p><a name="index-info-dcache-823"></a><br><dt><code>info dcache </code><span class="roman">[</span><code>line</code><span class="roman">]</span><dd>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>If a line number is specified, the contents of that line will be |
| printed in hex. |
| |
| <br><dt><code>set dcache size </code><var>size</var><dd><a name="index-dcache-size-824"></a><a name="index-set-dcache-size-825"></a>Set maximum number of entries in dcache (dcache depth above). |
| |
| <br><dt><code>set dcache line-size </code><var>line-size</var><dd><a name="index-dcache-line_002dsize-826"></a><a name="index-set-dcache-line_002dsize-827"></a>Set number of bytes each dcache entry caches (dcache width above). |
| Must be a power of 2. |
| |
| <br><dt><code>show dcache size</code><dd><a name="index-show-dcache-size-828"></a>Show maximum number of dcache entries. See <a href="Caching-Target-Data.html#Caching-Target-Data">info dcache</a>. |
| |
| <br><dt><code>show dcache line-size</code><dd><a name="index-show-dcache-line_002dsize-829"></a>Show default size of dcache lines. |
| |
| </dl> |
| |
| <div class="footnote"> |
| <hr> |
| <h4>Footnotes</h4><p class="footnote"><small>[<a name="fn-1" href="#fnd-1">1</a>]</small> 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> |
| |
| <hr></div> |
| |
| </body></html> |
| |