Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@gnu.org>
To: Thomas Schwinge <thomas@codesourcery.com>
Cc: bug-hurd@gnu.org, gdb-patches@sourceware.org
Subject: Re: [PATCHv3,Hurd] Add hardware watch support
Date: Tue, 16 Sep 2014 23:17:00 -0000	[thread overview]
Message-ID: <20140916231706.GA2933@type.youpi.perso.aquilenet.fr> (raw)
In-Reply-To: <87iokondoc.fsf@schwinge.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


  reply	other threads:[~2014-09-16 23:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-10 22:49 Samuel Thibault
2014-09-10 23:23 ` Sergio Durigan Junior
2014-09-12 18:21   ` Samuel Thibault
2014-09-12 19:18     ` Sergio Durigan Junior
2014-09-12 16:51 ` Joel Brobecker
2014-09-12 18:24   ` Samuel Thibault
2014-09-12 17:56 ` Thomas Schwinge
2014-09-12 18:01   ` Samuel Thibault
2014-09-12 20:01     ` Joel Brobecker
2014-09-12 21:24       ` Samuel Thibault
2014-09-12 21:42         ` Sergio Durigan Junior
2014-09-15 13:50         ` Joel Brobecker
2014-09-12 18:25   ` Samuel Thibault
2014-09-15 22:08   ` Thomas Schwinge
2014-09-15 23:09     ` Samuel Thibault
2014-09-16  9:00       ` Thomas Schwinge
2014-09-16 23:17         ` Samuel Thibault [this message]
2014-09-16 23:29           ` Samuel Thibault

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=20140916231706.GA2933@type.youpi.perso.aquilenet.fr \
    --to=samuel.thibault@gnu.org \
    --cc=bug-hurd@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=thomas@codesourcery.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