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]

Re: [RFA] Use data cache for stack accesses


On Thu, Aug 20, 2009 at 11:00 PM, Doug Evans<dje@google.com> wrote:
> On Wed, Jul 8, 2009 at 1:46 PM, Pedro Alves<pedro@codesourcery.com> wrote:
>> On Wednesday 08 July 2009 21:08:00, Jacob Potter write:
>>> --- a/gdb/thread.c
>>> +++ b/gdb/thread.c
>>> @@ -848,6 +848,9 @@ switch_to_thread (ptid_t ptid)
>>> ? ?if (ptid_equal (ptid, inferior_ptid))
>>> ? ? ?return;
>>>
>>> + ?if (ptid_get_pid (ptid) != ptid_get_pid (inferior_ptid))
>>> + ? ?dcache_invalidate (target_dcache);
>>> +
>>
>> I'm not sure this would be 100% multi-address space safe.
>>
>> Do we not have places where we switch inferior_ptid temporarily
>> before calling reading memory, with save_inferior_ptid, without
>> going through the high level switch_to_thread ?
>
> Yeah.
>
>> What if we do this within dcache itself, similarly
>> to get_thread_regcache? ?That would be probably in [dcache_xfer_partial].
>
> It seems that given that we can temporarily change inferiors without
> giving subsystems notice of the change, and given vfork, then we need
> to have intelligence in dcache to handle this (and then it's not clear
> if we should keep one dcache per inferior).
>
> How about having memory_xfer_partial notify dcache of every
> write/read, and then dcache could keep just one copy of the cache and
> flush it appropriately?
>

Something like this?

2009-08-24  Jacob Potter  <jdpotter@google.com>
            Doug Evans  <dje@google.com>

        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.
        (stack_cache_enabled_p): New static global.
        (show_dcache_enabled_p): Flag option as deprecated.
        (show_stack_cache_enabled_p): New function.
        (dcache_invalidate): Update ptid.
        (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.
        (dcache_update): New function.
        (dcache_info): Report ptid.
        (_initialize_dcache): Update text for `remotecache' to indicate it
        is obsolete.  Install new option `stack-cache'.
        * dcache.h (dcache_update): Declare.
        (stack_cache_enabled_p): 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.
        * target.c (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.
        * target.h (enum target_object): New value TARGET_OBJECT_STACK_MEMORY.
        (target_read_stack): 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.

        * doc/gdb.texinfo (Caching Data of Remote Targets): Update text.
        (set remotecache): Mark option as obsolete.
        (set stack-cache): Document new option.
        (info dcache): Update text.

Attachment: 090824-jdpotter-stack-cache-3.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]