Next: Searching Memory, Previous: Character Sets, Up: Data
gdb caches data exchanged between the debugger and a target. Each cache is associated with the address space of the inferior. See Inferiors and Programs, about inferior and address space. Such caching generally improves performance in remote debugging (see Remote Debugging), 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 gdb does not necessarily know anything about volatile values, memory-mapped I/O addresses, etc. Furthermore, in non-stop mode (see Non-Stop Mode) memory can be changed while a gdb command is executing. Therefore, by default, gdb only caches data known to be on the stack1 or in the code segment. Other regions of memory can be explicitly marked as cacheable; see Memory Region Attributes.
set remotecache onset remotecache offshow remotecacheset stack-cache onset stack-cache offon, use
caching. By default, this option is on.
show stack-cacheset code-cache onset code-cache offon,
use caching. By default, this option is on. This improves
performance of disassembly in remote debugging.
show code-cacheinfo dcache [line]If a line number is specified, the contents of that line will be
printed in hex.
set dcache size sizeset dcache line-size line-sizeshow dcache sizeshow dcache line-size[1] 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.