This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC: fix race in multiexec case
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: Vladimir Prus <vladimir at codesourcery dot com>
- Date: Wed, 6 Jan 2010 16:31:59 +0000
- Subject: Re: RFC: fix race in multiexec case
- References: <201001051126.58970.vladimir@codesourcery.com>
On Tuesday 05 January 2010 08:26:58, Vladimir Prus wrote:
> However, find_lwp_pid returns NULL for null_ptid, and this code segfaults.
> I attach a minimal patch that appears to fix this, but I feel uneasy about it.
Ah, this bit runs before the almighty context_switch line. Your fix is correct.
> Maybe, inferior_ptid should be reset much earlier?
Yes, at some point, we should clean this all up and context switch
as soon as we see an event, like in non-stop (fetch_inferior_event).
Not much point in not doing so, now that the globals that formed
the supposed "context" are gone.
> diff --git a/gdb/infrun.c b/gdb/infrun.c
> index d8ca40d..300af62 100644
> --- a/gdb/infrun.c
> +++ b/gdb/infrun.c
> @@ -3232,7 +3232,8 @@ targets should add new threads to the thread list themselves in non-stop mode.")
> if (ecs->event_thread->stop_signal == TARGET_SIGNAL_TRAP)
> {
> int thread_hop_needed = 0;
> - struct address_space *aspace = get_regcache_aspace (get_current_regcache ());
> + struct address_space *aspace =
> + get_regcache_aspace (get_thread_regcache (ecs->ptid));
>
> /* Check if a regular breakpoint has been hit before checking
> for a potential single step breakpoint. Otherwise, GDB will
>
This is OK.
--
Pedro Alves