From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2037 invoked by alias); 9 Dec 2013 11:53:51 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 2028 invoked by uid 89); 9 Dec 2013 11:53:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 09 Dec 2013 11:53:48 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rB9BrdTi010814 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 9 Dec 2013 06:53:39 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rB9Brb9F020076; Mon, 9 Dec 2013 06:53:38 -0500 Message-ID: <52A5AF41.6080207@redhat.com> Date: Mon, 09 Dec 2013 11:53:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Yao Qi CC: Mark Kettenis , gdb-patches@sourceware.org Subject: Re: [PATCH 2/3] skip_prolgoue (amd64) References: <1385735051-27558-1-git-send-email-yao@codesourcery.com> <1385735051-27558-3-git-send-email-yao@codesourcery.com> <201311291436.rATEaZ5Z030292@glazunov.sibelius.xs4all.nl> <201311291605.rATG5XVb030184@glazunov.sibelius.xs4all.nl> <52994E79.4000004@codesourcery.com> <5299B9D0.2020304@redhat.com> <529C37A2.9000207@codesourcery.com> <529E9462.9010001@codesourcery.com> <529F1B1F.2040606@redhat.com> <52A426E8.2030808@codesourcery.com> In-Reply-To: <52A426E8.2030808@codesourcery.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-12/txt/msg00333.txt.bz2 On 12/08/2013 07:59 AM, Yao Qi wrote: > After some discussions, it becomes clear to me that we should flush > target cache before handling events, in the place of the callers of > handle_inferior_event. I am wondering why don't we flush cache inside > handle_inferior_event? Although flushing cache is not much relevant > to handle_inferior_event, this can avoid doing cache flush in every > caller of handle_inferior_event. The concern is that target_wait implementations may read memory. wait_for_inferior & friends used to have a registers_changed call and this comment: /* We have to invalidate the registers BEFORE calling target_wait because they can be loaded from the target while in target_wait. This makes remote debugging a bit more efficient for those targets that provide critical registers as part of their normal status mechanism. */ overlay_cache_invalid = 1; registers_changed (); if (deprecated_target_wait_hook) ecs->ptid = deprecated_target_wait_hook (waiton_ptid, &ecs->ws, 0); else ecs->ptid = target_wait (waiton_ptid, &ecs->ws, 0); Removed here: https://sourceware.org/ml/gdb-patches/2011-09/msg00122.html That was easy to do given we can't read registers of running threads, so we're sure a new regcache will be created for the just stopped thread, but for memory it looks simpler and safer to me to flush before target_wait instead of going through all possible target_wait paths that could read memory and be sure to flush there. -- Pedro Alves