From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7614 invoked by alias); 3 Apr 2007 07:13:44 -0000 Received: (qmail 7606 invoked by uid 22791); 3 Apr 2007 07:13:44 -0000 X-Spam-Check-By: sourceware.org Received: from wr-out-0506.google.com (HELO wr-out-0506.google.com) (64.233.184.228) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 03 Apr 2007 08:13:40 +0100 Received: by wr-out-0506.google.com with SMTP id i22so1633490wra for ; Tue, 03 Apr 2007 00:13:38 -0700 (PDT) Received: by 10.114.169.2 with SMTP id r2mr2149062wae.1175584418106; Tue, 03 Apr 2007 00:13:38 -0700 (PDT) Received: by 10.114.168.19 with HTTP; Tue, 3 Apr 2007 00:13:38 -0700 (PDT) Message-ID: Date: Tue, 03 Apr 2007 07:13:00 -0000 From: "Wang Yi" To: gdb@sourceware.org Subject: Use debug registers directly in programs? MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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/msg00020.txt.bz2 Hi, all gdb is a general purpose debugger, it's very strong. But on some specific conditions, somebody would like to provide a mechanism to let the program debug itself. I mean to provide a subset function of gdb's, such as only use CPU debug registers to set watchpoints. I think combining with code instrumentation, this mechanism will partially fulfill auto-debug function and save our time. The questions are: 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? Leo