This is the mail archive of the
mailing list for the GDB project.
Re: [PATCH 0/2] Fix x86 debug registers on FreeBSD with threads
- From: Pedro Alves <palves at redhat dot com>
- To: John Baldwin <jhb at FreeBSD dot org>, gdb-patches at sourceware dot org
- Date: Fri, 1 Jul 2016 14:02:39 +0100
- Subject: Re: [PATCH 0/2] Fix x86 debug registers on FreeBSD with threads
- Authentication-results: sourceware.org; auth=none
- References: <20160628225507 dot 80772-1-jhb at FreeBSD dot org>
On 06/28/2016 11:55 PM, John Baldwin wrote:
> The pan-BSD x86 debug register support code was only setting the
> debug registers on the current LWP identified by inferior_ptid.
> This fixes the code to set the debug registers on all of the LWPs
> belonging to the current inferior on each change.
Looks good to me.
Spotted a missing space in:
> One question I have is that the amd64 x86 debug register code was
> invoking x86_cleanup_dregs in the mourn_inferior target op, but
> the x86 linux native code calls this in the post_startup_inferior
> target op instead. Any ideas as to why they are different?
Not sure. Probably history, or maybe to be sure to paper over
potential problems from the "inferior exit/dies/detached" end missing
clearing the reg state. OTOH, I think target_post_startup_inferior
isn't called for attach.
Note that mourn_inferior isn't called in some cases. Some targets call
it from within their to_detach and to_kill target methods, but that's
not guaranteed. I think that linux-nat.c doesn't call it from its
to_detach, but OTOH, when you get there, watchpoints had better have
been removed from the target already. But maybe there's a problem
as follow-fork time, not sure. Note that the linux native code
also calls x86_forget_process directly through linux_nat_forget_process.
> John Baldwin (2):
> Consolidate x86 debug register code for BSD native targets.
> Set debug registers on all threads belonging to the current inferior.