From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8233 invoked by alias); 9 Dec 2013 01:45:58 -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 8217 invoked by uid 89); 9 Dec 2013 01:45:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.5 required=5.0 tests=AWL,BAYES_00,GARBLED_BODY 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; Mon, 09 Dec 2013 01:45:55 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1Vppul-00051e-31 from Yao_Qi@mentor.com ; Sun, 08 Dec 2013 17:45:39 -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); Sun, 8 Dec 2013 17:45:38 -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; Sun, 8 Dec 2013 17:45:37 -0800 Message-ID: <52A5206C.5070301@codesourcery.com> Date: Mon, 09 Dec 2013 01:45: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: Doug Evans CC: Pedro Alves , 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: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2013-12/txt/msg00316.txt.bz2 On 12/08/2013 04:25 PM, Doug Evans wrote: > If you're going for correctness here, note that this is just another heuristic. > It gets one closer, but as long as at least one thread is still running .... > I remind myself adding comments like that, but forgot doing so in the end. Add it in the comments in the updated patch. > Question: Does this obviate the need to call target_dcache_invalidate elsewhere? > If so, removing other uses that this subsumes should be part of this patch. > Presently, target_dcache_invalidate is called by some places: - In commands on dcache and memattr, - In target_load and target_resume, - In tfind_1, - In prepare_execute_command, I am wondering we may remove the call in prepare_execute_command, because it is more "precise" to flush cache for every event than for every command. However, I am not sure, but I attach the patch. > Nit: "cache would be staled" is bad English. > "the cache could be stale" would be better, though I'm sure there is > something even better than that. > [I suspect there's at least one too many commas in there too, but one > can nitpick too much. :-)] Fixed. -- Yao (齐尧) gdb: 2013-12-09 Yao Qi * infrun.c: Include "target-dcache.h". (handle_inferior_event): Flush target cache. --- gdb/infrun.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index 3b55583..2901d09 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 */ @@ -3168,6 +3169,12 @@ handle_inferior_event (struct execution_control_state *ecs) { enum stop_kind stop_soon; + /* If we've got an event from target, it means the target was + running and cache could be stale. Flush target cache before + handling each event. This is just a heuristic. Running threads + may modify target memory, but we don't get any event. */ + target_dcache_invalidate (); + if (ecs->ws.kind == TARGET_WAITKIND_IGNORE) { /* We had an event in the inferior, but we are not interested in -- 1.7.7.6 gdb: 2013-12-09 Yao Qi * top.c: Don't include "target-dcache.h". (prepare_execute_command): Remove the call to target_dcache_invalidate. --- gdb/top.c | 8 -------- 1 files changed, 0 insertions(+), 8 deletions(-) diff --git a/gdb/top.c b/gdb/top.c index 8ce1a9f..b7df81b 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -28,7 +28,6 @@ #include "exceptions.h" #include #include "target.h" -#include "target-dcache.h" #include "breakpoint.h" #include "gdbtypes.h" #include "expression.h" @@ -332,13 +331,6 @@ prepare_execute_command (void) mark = value_mark (); cleanup = make_cleanup_value_free_to_mark (mark); - /* With multiple threads running while the one we're examining is - stopped, the dcache can get stale without us being able to detect - it. For the duration of the command, though, use the dcache to - help things like backtrace. */ - if (non_stop) - target_dcache_invalidate (); - return cleanup; } -- 1.7.7.6