This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/3] skip_prolgoue (amd64)
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: Mark Kettenis <mark dot kettenis at xs4all dot nl>, gdb-patches at sourceware dot org
- Date: Mon, 09 Dec 2013 11:53:37 +0000
- Subject: Re: [PATCH 2/3] skip_prolgoue (amd64)
- Authentication-results: sourceware.org; auth=none
- References: <1385735051-27558-1-git-send-email-yao at codesourcery dot com> <1385735051-27558-3-git-send-email-yao at codesourcery dot com> <201311291436 dot rATEaZ5Z030292 at glazunov dot sibelius dot xs4all dot nl> <201311291605 dot rATG5XVb030184 at glazunov dot sibelius dot xs4all dot nl> <52994E79 dot 4000004 at codesourcery dot com> <5299B9D0 dot 2020304 at redhat dot com> <529C37A2 dot 9000207 at codesourcery dot com> <529E9462 dot 9010001 at codesourcery dot com> <529F1B1F dot 2040606 at redhat dot com> <52A426E8 dot 2030808 at codesourcery dot com>
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