From: Yao Qi <yao@codesourcery.com>
To: Doug Evans <xdje42@gmail.com>
Cc: Pedro Alves <palves@redhat.com>,
Mark Kettenis <mark.kettenis@xs4all.nl>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH 2/3] skip_prolgoue (amd64)
Date: Mon, 09 Dec 2013 01:45:00 -0000 [thread overview]
Message-ID: <52A5206C.5070301@codesourcery.com> (raw)
In-Reply-To: <CAP9bCMRG2RkWLoVgE56OAXs0hoghv_Bfq-PwuGQy5wMYo2GK8A@mail.gmail.com>
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 <yao@codesourcery.com>
* 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 <yao@codesourcery.com>
* 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 <signal.h>
#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
next prev parent reply other threads:[~2013-12-09 1:45 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-29 14:27 [PATCH 0/3] Use target_read_code in skip_prologue Yao Qi
2013-11-29 14:27 ` [PATCH 2/3] skip_prolgoue (amd64) Yao Qi
2013-11-29 14:38 ` Mark Kettenis
2013-11-29 18:55 ` Mark Kettenis
2013-11-30 3:40 ` Yao Qi
2013-11-30 12:01 ` Pedro Alves
2013-12-02 7:34 ` Yao Qi
2013-12-03 18:28 ` Pedro Alves
2013-12-04 2:34 ` Yao Qi
2013-12-04 12:08 ` Pedro Alves
2013-12-04 15:38 ` Tom Tromey
2013-12-04 18:31 ` Doug Evans
2013-12-05 11:31 ` Pedro Alves
2013-12-05 1:21 ` Yao Qi
2013-12-05 12:08 ` Pedro Alves
2013-12-05 14:08 ` Yao Qi
2013-12-05 14:37 ` Pedro Alves
2013-12-08 8:01 ` Yao Qi
2013-12-08 8:26 ` Doug Evans
2013-12-09 1:45 ` Yao Qi [this message]
2013-12-09 11:32 ` Pedro Alves
2013-12-09 11:53 ` Pedro Alves
2013-12-09 13:03 ` Yao Qi
2013-12-09 13:13 ` Pedro Alves
2013-12-09 13:58 ` Yao Qi
2013-12-09 15:34 ` Pedro Alves
2013-12-10 0:57 ` Yao Qi
2013-12-10 10:23 ` Pedro Alves
2013-12-10 12:02 ` Yao Qi
2013-12-04 17:42 ` Doug Evans
2013-12-04 18:00 ` Doug Evans
2013-12-04 17:54 ` Doug Evans
2013-12-05 1:39 ` Yao Qi
2013-12-05 11:47 ` Pedro Alves
2013-11-29 14:36 ` [PATCH 1/3] Use target_read_code in skip_prologue (i386) Yao Qi
2013-11-30 11:43 ` Pedro Alves
2013-11-29 14:38 ` [PATCH 3/3] Perf test case: skip-prologue Yao Qi
2013-12-03 7:34 ` Yao Qi
2013-12-10 12:45 ` Yao Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52A5206C.5070301@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=mark.kettenis@xs4all.nl \
--cc=palves@redhat.com \
--cc=xdje42@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox