This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Use debug registers directly in programs?
- From: "Wang Yi" <leonidwang at gmail dot com>
- To: gdb at sourceware dot org
- Date: Tue, 3 Apr 2007 15:13:38 +0800
- Subject: Use debug registers directly in programs?
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