From 4e5d721fc0b3a9de5764a7b3bf3d6be4132ab67b Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Mon, 31 Aug 2009 20:18:46 +0000 Subject: Implement TARGET_OBJECT_STACK_MEMORY. * NEWS: Add note on new "set stack-cache" option. * corefile.c (read_stack): New function. * dcache.c (dcache_struct): New member ptid. (dcache_enable_p): Mark as obsolete. (show_dcache_enabled_p): Flag option as deprecated. (dcache_invalidate): Update ptid. (dcache_invalidate_line): New function. (dcache_read_line): No longer check cacheable attribute, stack accesses get cached despite attribute. (dcache_init): Set ptid. (dcache_xfer_memory): Flush cache if from different ptid than before. Update cache after write. (dcache_update): New function. (dcache_info): Report ptid. (_initialize_dcache): Update text for `remotecache' to indicate it is obsolete. * dcache.h (dcache_update): Declare. * dwarf2loc.c (dwarf2_evaluate_loc_desc): Mark values on stack with set_value_stack. * frame-unwind.c (frame_unwind_got_memory): Ditto. * gdbcore.h (read_stack): Declare. * memattr.c (mem_enable_command): Call target_dcache_invalidate instead of dcache_invalidate. (mem_disable_command, mem_delete_command): Ditto. * target.c (stack_cache_enabled_p_1): New static global. (stack_cache_enabled_p): New static global. (set_stack_cache_enabled_p): New function. (show_stack_cache_enabled_p): New function. (target_dcache): Make static. (target_dcache_invalidate): New function. (target_load, target_resume): Call target_dcache_invalidate instead of dcache_invalidate. (memory_xfer_partial): New arg object, all callers updated. Check for existing inferior before calling dcache routines. When writing non-TARGET_OBJECT_STACK_MEMORY, notify dcache. (target_xfer_partial): Call memory_xfer_partial for TARGET_OBJECT_STACK_MEMORY. (target_read_stack): New function. (initialize_targets): Install new option `stack-cache'. * target.h: Remove #include of dcache.h. (enum target_object): New value TARGET_OBJECT_STACK_MEMORY. (target_dcache): Delete. (target_dcache_invalidate): Declare. (target_read_stack): Declare. * top.c (prepare_execute_command): New function. (execute_command): Call prepare_execute_command instead of free_all_values. * top.h (prepare_execute_command): Declare. * valops.c (get_value_at): New function. (value_at): Guts moved to get_value_at. (value_at_lazy): Similarly. (value_fetch_lazy): Call read_stack for stack values. * value.c (struct value): New member `stack'. (value_stack, set_value_stack): New functions. * value.h (value_stack, set_value_stack): Declare. * mi/mi-main.c (mi_cmd_execute): Call prepare_execute_command instead of free_all_values. doc/ * gdb.texinfo (Caching Data of Remote Targets): Update text. Mark `set/show remotecache' options as obsolete. Document new `set/show stack-cache' option. Update text for `info dcache'. --- gdb/doc/ChangeLog | 8 ++++++++ gdb/doc/gdb.texinfo | 41 ++++++++++++++++++++++++++++------------- 2 files changed, 36 insertions(+), 13 deletions(-) (limited to 'gdb/doc') diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 3423ee2..8831e0a 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,11 @@ +2009-08-31 Jacob Potter + Doug Evans + + * gdb.texinfo (Caching Data of Remote Targets): Update text. + Mark `set/show remotecache' options as obsolete. + Document new `set/show stack-cache' option. + Update text for `info dcache'. + 2009-08-27 Doug Evans * gdb.texinfo (Symbols): Delete `set print symbol-loading'. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index cc66d12..0e9fd44 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -8421,32 +8421,47 @@ character. @section Caching Data of Remote Targets @cindex caching data of remote targets -@value{GDBN} can cache data exchanged between the debugger and a +@value{GDBN} caches data exchanged between the debugger and a remote target (@pxref{Remote Debugging}). Such caching generally improves performance, because it reduces the overhead of the remote protocol by -bundling memory reads and writes into large chunks. Unfortunately, -@value{GDBN} does not currently know anything about volatile -registers, and thus data caching will produce incorrect results when -volatile registers are in use. +bundling memory reads and writes into large chunks. Unfortunately, simply +caching everything would lead to incorrect results, since @value{GDBN} +does not necessarily know anything about volatile values, memory-mapped I/O +addresses, etc. Therefore, by default, @value{GDBN} only caches data +known to be on the stack. Other regions of memory can be explicitly marked +cacheable; see @pxref{Memory Region Attributes}. @table @code @kindex set remotecache @item set remotecache on @itemx set remotecache off -Set caching state for remote targets. When @code{ON}, use data -caching. By default, this option is @code{OFF}. +This option no longer does anything; it exists for compatibility +with old scripts. @kindex show remotecache @item show remotecache -Show the current state of data caching for remote targets. +Show the current state of the obsolete remotecache flag. + +@kindex set stack-cache +@item set stack-cache on +@itemx set stack-cache off +Enable or disable caching of stack accesses. When @code{ON}, use +caching. By default, this option is @code{ON}. + +@kindex show stack-cache +@item show stack-cache +Show the current state of data caching for memory accesses. @kindex info dcache -@item info dcache +@item info dcache @r{[}line@r{]} Print the information about the data cache performance. The -information displayed includes: the dcache width and depth; and for -each cache line, how many times it was referenced, and its data and -state (invalid, dirty, valid). This command is useful for debugging -the data cache operation. +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. + +If a line number is specified, the contents of that line will be +printed in hex. @end table @node Searching Memory -- cgit v1.1