From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10771 invoked by alias); 4 Dec 2013 02:34:55 -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 10760 invoked by uid 89); 4 Dec 2013 02:34:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=3.2 required=5.0 tests=AWL,BAYES_50,GARBLED_BODY,RDNS_NONE,URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: relay1.mentorg.com Received: from Unknown (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 04 Dec 2013 02:34:53 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1Vo2IO-00050m-Oo from Yao_Qi@mentor.com ; Tue, 03 Dec 2013 18:34:36 -0800 Received: from SVR-ORW-FEM-02.mgc.mentorg.com ([147.34.96.206]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 3 Dec 2013 18:34:36 -0800 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.2.247.3; Tue, 3 Dec 2013 18:34:35 -0800 Message-ID: <529E9462.9010001@codesourcery.com> Date: Wed, 04 Dec 2013 02:34:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Pedro Alves CC: Mark Kettenis , 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> In-Reply-To: <529C37A2.9000207@codesourcery.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2013-12/txt/msg00113.txt.bz2 On 12/02/2013 03:32 PM, Yao Qi wrote: > GDB target cache contains both code cache and stack cache. GDB can > know the JIT event by means of jit event breakpoint, but GDB can't know > whether a thread's stack is modified (by other threads). So we have > to flush target cache before handling*every* event :-/ I'll send a > follow-up patch. When I finished the patch below, I wondered whether this is the right way to go. Nowadays, in non-stop mode, GDB flushes target cache between each command. With the patch applied, GDB flushes target cache between each event. Then, I realize that GDB flushes cache at any changes (GDB commands from user and events from inferior) in non-stop mode, so I can't figure out a case that cache can be used. Do we still need target cache in non-stop mode? -- Yao (齐尧) Subject: [PATCH] Flush target dcache in non-stop before handling events gdb: 2013-12-04 Yao Qi * infrun.c: Include "target-dcache.h". (fetch_inferior_event): Call target_dcache_invalidate in non-stop. --- gdb/infrun.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index 3b55583..2ed0537 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -60,6 +60,7 @@ #include "objfiles.h" #include "completer.h" #include "target-descriptions.h" +#include "target-dcache.h" /* Prototypes for local functions */ @@ -2806,6 +2807,16 @@ fetch_inferior_event (void *client_data) overlay_cache_invalid = 1; + if (non_stop) + { + /* In non-stop mode, one thread stops and caches the contents of + stack or code, while other running threads may change the + code (through JIT) or stack. The target cache can get stale + without us being able to detect it. Flush target cache + before handling each event. */ + target_dcache_invalidate (); + } + make_cleanup_restore_integer (&execution_direction); execution_direction = target_execution_direction (); -- 1.7.7.6