From: Michael Snyder <Michael.Snyder@access-company.com>
To: Mathieu Lacage <Mathieu.Lacage@sophia.inria.fr>
Cc: Wang Yi <leonidwang@gmail.com>, gdb@sourceware.org
Subject: Re: Use debug registers directly in programs?
Date: Tue, 03 Apr 2007 19:52:00 -0000 [thread overview]
Message-ID: <1175629931.11945.15.camel@svmsnyderlnx.palmsource.com> (raw)
In-Reply-To: <1175585450.3988.167.camel@garfield.inria.fr>
On Tue, 2007-04-03 at 09:30 +0200, Mathieu Lacage wrote:
> 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.
Yes, instructions to access the debug registers are almost always
privileged instructions. User programs cannot use them. Even gdb
cannot access them directly, it has to ask the Kernel to do it.
Hence the ptrace interface, and as Mathieu says, a program cannot
ptrace itself.
prev parent reply other threads:[~2007-04-03 19:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-03 7:13 Wang Yi
2007-04-03 7:32 ` Mathieu Lacage
2007-04-03 19:52 ` Michael Snyder [this message]
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=1175629931.11945.15.camel@svmsnyderlnx.palmsource.com \
--to=michael.snyder@access-company.com \
--cc=Mathieu.Lacage@sophia.inria.fr \
--cc=gdb@sourceware.org \
--cc=leonidwang@gmail.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