This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCHv3,Hurd] Add hardware watch support
- From: Samuel Thibault <samuel dot thibault at gnu dot org>
- To: Thomas Schwinge <thomas at codesourcery dot com>
- Cc: bug-hurd at gnu dot org, gdb-patches at sourceware dot org
- Date: Wed, 17 Sep 2014 01:17:06 +0200
- Subject: Re: [PATCHv3,Hurd] Add hardware watch support
- Authentication-results: sourceware.org; auth=none
- References: <20140910224919 dot GP3244 at type dot youpi dot perso dot aquilenet dot fr> <874mwcpvsy dot fsf at schwinge dot name> <87lhpko7um dot fsf at schwinge dot name> <20140915230950 dot GB2942 at type dot youpi dot perso dot aquilenet dot fr> <87iokondoc dot fsf at schwinge dot name>
Hello,
Thomas Schwinge, le Tue 16 Sep 2014 10:59:47 +0200, a écrit :
> On Tue, 16 Sep 2014 01:09:50 +0200, Samuel Thibault <samuel.thibault@gnu.org> wrote:
> > Thomas Schwinge, le Tue 16 Sep 2014 00:08:01 +0200, a écrit :
> > > Do you agree that thread_get_state(i386_DEBUG_STATE) should be
> > > returning the actual DR6,
> >
> > Indeed.
> >
> > > and where in GNU Mach would we need to copy the DR6
> > > register into the PCB?
> >
> > it would be user_trap(), probably, in the T_DEBUG case.
>
> Thanks for the pointer. Something like the following does accomplish its
> task w.r.t. GDB, but there are some TODO items. It might help to compare
> what the Linux kernel is doing; »git grep --cached -i dr6 -- arch/x86/«
> or similar.
I believe this will be fine to only expose the known-to-be-safe
information, and clean dr6:
diff --git a/i386/i386/trap.c b/i386/i386/trap.c
index 200cbcc..661bc6a 100644
--- a/i386/i386/trap.c
+++ b/i386/i386/trap.c
@@ -395,6 +395,10 @@ printf("user trap %d error %d sub %08x\n", type, code, subcode);
return 0;
}
#endif /* MACH_KDB */
+ /* Make the content of the debug status register (DR6)
+ available to user space. */
+ thread->pcb->ims.ids.dr[6] = get_dr6() & 0x600F;
+ set_dr6(0);
exc = EXC_BREAKPOINT;
code = EXC_I386_SGL;
break;
Does it fix GDB too?
Samuel