From patchwork Tue Sep 16 23:17:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 2872 Received: (qmail 28175 invoked by alias); 16 Sep 2014 23:17:15 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 28163 invoked by uid 89); 16 Sep 2014 23:17:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: sonata.ens-lyon.org Received: from sonata.ens-lyon.org (HELO sonata.ens-lyon.org) (140.77.166.138) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 16 Sep 2014 23:17:12 +0000 Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 50CCC200A0; Wed, 17 Sep 2014 01:17:09 +0200 (CEST) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0llYHS5iBQ3J; Wed, 17 Sep 2014 01:17:09 +0200 (CEST) Received: from type.youpi.perso.aquilenet.fr (youpi.perso.aquilenet.fr [80.67.176.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 1385A2009C; Wed, 17 Sep 2014 01:17:09 +0200 (CEST) Received: from samy by type.youpi.perso.aquilenet.fr with local (Exim 4.84) (envelope-from ) id 1XU1ze-0007DB-Nh; Wed, 17 Sep 2014 01:17:06 +0200 Date: Wed, 17 Sep 2014 01:17:06 +0200 From: Samuel Thibault To: Thomas Schwinge Cc: bug-hurd@gnu.org, gdb-patches@sourceware.org Subject: Re: [PATCHv3,Hurd] Add hardware watch support Message-ID: <20140916231706.GA2933@type.youpi.perso.aquilenet.fr> Mail-Followup-To: Thomas Schwinge , bug-hurd@gnu.org, gdb-patches@sourceware.org References: <20140910224919.GP3244@type.youpi.perso.aquilenet.fr> <874mwcpvsy.fsf@schwinge.name> <87lhpko7um.fsf@schwinge.name> <20140915230950.GB2942@type.youpi.perso.aquilenet.fr> <87iokondoc.fsf@schwinge.name> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87iokondoc.fsf@schwinge.name> User-Agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) 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 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: Does it fix GDB too? Samuel 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;