This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi - Here's a patch to clean up the data cache code and add an option to use it for all stack accesses. It's in two parts, first the rewrite of the cache itself, and then the changes to other code to use it. The first part of the patch makes the cache set-associative and write-through. As originally implemented, the cache had writeback capability; data could be written to the cache and marked as not having been written to the target yet. However, all the code paths through the cache actually wrote to the target immediately after each write command to the cache, so there was no performance advantage and significant complexity to deal with writeback. Making the cache set-associative rather than fully-associative allows the size to be increased significantly without performance penalties. Previously, a cache lookup cost O(n) as the size of the cache. Figuring out when to cache is tough.There are plenty of situations where it's clearly not OK to cache data on GDB's end, most importantly memory mapped I/O. However, we know that if a given access is known to be on the stack, it's not going to lie in I/O or otherwise special memory and it's somewhat less likely to even be shared among threads. Building a backtrace requires a lot of small accesses all referring to the stack, so caching them accelerates remote debugging significantly without affecting correctness. The old "remotecache" flag didn't actually do anything. Caching was enabled by adding a cacheable memory region. This patch leaves that functionality unchanged, but makes the remotecache option explicitly deprecated and nonfunctional. It's still left around to avoid breaking scripts, though. There's a new "stackcache" flag which enables the cache for memory accesses known to be for the stack. It currently defaults to off, but can always be safely set to on; hopefully the default can be changed over at some point in the future. - Jacob 2009-06-26? Jacob Potter? <jdpotter@google.com> ??????? * dcache.c (DCACHE_SET_SIZE, DCACHE_SET_SIZE_POWER, DCACHE_ASSOC, ??????? BLOCKNUM): Define. ??????? (DCACHE_SIZE, ENTRY_INVALID, ENTRY_VALID, ENTRY_DIRTY): Delete. ??????? (struct dcache_block): Clean up; remove "anydirty" field ??????? (struct dcache_set): New struct. ??????? (struct dcache_struct): Redefine as a set (array) of blocks, rather ??????? than a linked list. ??????? (dcache_writeback): Remove declaration. ??????? (dcache_enabled_p): Delete; replaced by the two flags below. ??????? (dcache_stack_enabled_p, remotecache_enabled_p): New flags. ??????? (show_dcache_enabled_p): Clarify status message. ??????? (show_remotecache_enabled_p): New function. ??????? (dcache_invalidate, dcache_hit): Rewrite for new cache structure. ??????? (dcache_write_line): Delete. ??????? (dcache_read_line, dcache_alloc): Rewrite for new cache structure. ??????? (dcache_write_line): Delete. ??????? (dcache_peek_byte): Clean up; remove "invalid" state check. ??????? (dcache_poke_byte): Rewrite for new cache structure; clarify comment. ??????? (dcache_init, dcache_free): Rewrite for new cache structure. ??????? (dcache_xfer_memory): Rewrite for new write-through cache structure. ??????? (dcache_update, dcache_print_line): New functions. ??????? (dcache_info): Rewrite for new cache structure. ??????? (_initialize_dcache): Rewrite for new cache structure. ??????? * dcache.h (dcache_xfer_memory): Update definition. ??????? (dcache_update, dcache_stack_enabled_p): Declare. ??????? * target.c (memory_xfer_partial): Update calls to dcache_xfer_memory. ??????? * corefile.c, gdbcore.h (read_stack): New helper for stack reads. ??????? * dwarf2loc.c (dwarf2_evaluate_loc_desc): Mark value as stack. ??????? * frame-unwind.c (frame_unwind_got_memory): Mark value as stack. ??????? * target.c, target.h: Add new value to enum target_object, ??????? TARGET_OBJECT_STACK_MEMORY, for stack memory accesses; pass a ??????? target_object to memory_xfer_partial(). Handle stack accesses via ??????? dcache_xfer_memory(). ??????? (target_read_stack): New helper for stack reads. ??????? * valops.c (get_value_at): Refactor common code from value_at() and ??????? value_at_lazy() into new helper function; add value_at_lazy_stack(). ??????? * value.c, value.h (struct value): Add new field "stack" to mark values on ??????? the stack. ??????? (value_fetch_lazy): Correctly fetch values marked as stack. ??????? (value_stack, set_value_stack): New accessors.
Attachment:
part1-dcache-rewrite.patch.txt
Description: Text document
Attachment:
part2-use-cache-for-stack.patch.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |