[lkml]   [2001]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [RFC][PATCH] Debug Register Allocation on x86
Hello Jim,

We have modified ptrace() such that it first allocates the debug register
before it is used. So, yes, if a debugger is using ptrace() interface it
need not be concerned about this centralised debug register allocation
scheme, the debug register allocation actually happens behind the scenes
and it is guaranteed that other debug facilities don't overwrite your
settings. However, when you try to access a debug register for the first
time using ptrace, be sure to check the return value. It can return -EBUSY
if the debug register you are trying to use is already being used by other

You cannot rely on determining free debug registers by checking dr7: it is
possible that a debug register can be allocated from under you after you
have checked that it is free but before you have updated dr7 with new

Regards.. Vamsi.

Vamsi Krishna S.
Linux Technology Center, IBM India, Bangalore.
Ph: +91 80 5262355 Extn: 3672

---------------------- Forwarded by Bharata B Rao/India/IBM on 04/04/2001
08:49 AM ---------------------------

James Cownie <> on 04/03/2001 09:53:22 PM

Please respond to James Cownie <>

To: Bharata B Rao/India/IBM@IBMIN
cc: John DelSignore <>
Subject: [RFC][PATCH] Debug Register Allocation on x86


If I understand your patch correctly, it does not require that code
using the debug registers via ptrace is changed, since you notice the
use of a debug register in the ptrace write request and then allocate
it ?

Is this right ?

Our TotalView debugger also uses the debug registers to implement data
watchpoints on Linux/x86, and we search for free watchpoint registers
by looking at the control register, and then update all of the
watchpoint registers (skipping dr4 and dr5). I'm not sure how this
will work with your code...

p.s. You can download a copy of Totalview and get a demo license from
the web if you want to play with it.

Reference :

-- Jim

James Cownie <>
Etnus, LLC. +44 117 9071438

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:23    [W:0.045 / U:0.004 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site