From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12619 invoked by alias); 3 Apr 2007 07:32:23 -0000 Received: (qmail 12606 invoked by uid 22791); 3 Apr 2007 07:32:21 -0000 X-Spam-Check-By: sourceware.org Received: from sophia.inria.fr (HELO sophia.inria.fr) (138.96.64.20) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 03 Apr 2007 08:32:18 +0100 Received: from localhost (localhost [127.0.0.1]) by sophia.inria.fr (8.13.8/8.13.8) with ESMTP id l337WCh0016161; Tue, 3 Apr 2007 09:32:13 +0200 Received: from garfield.inria.fr (garfield.inria.fr [138.96.88.66]) (authenticated bits=0) by sophia.inria.fr (8.13.8/8.13.8) with ESMTP id l337Uogm015633 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO); Tue, 3 Apr 2007 09:30:50 +0200 Subject: Re: Use debug registers directly in programs? From: Mathieu Lacage To: Wang Yi Cc: gdb@sourceware.org In-Reply-To: References: Content-Type: text/plain Date: Tue, 03 Apr 2007 07:32:00 -0000 Message-Id: <1175585450.3988.167.camel@garfield.inria.fr> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 (2.6.3-1.fc5.5) Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (sophia.inria.fr [138.96.64.20]); Tue, 03 Apr 2007 09:30:50 +0200 (MEST) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-04/txt/msg00021.txt.bz2 On Tue, 2007-04-03 at 15:13 +0800, Wang Yi wrote: > 1. Is that feasible to use debug registers in the programs to > debug themselves? I think yes, any confirm? > 2. How to use the debug registers? The IA32 manual talks about > these registers but doesn't tell how to use them, the gdb internals > covers many areas but it is too complex for those who have not written > or read a debugger before. Should I read the gdb source? The only way I know of to set the debug registers is to use ptrace and a program cannot ptrace itself so, you will always need a third-party program if only to control the debug registers on your behalf. Mathieu --