Daniel Jacobowitz wrote:
On Wed, Jun 25, 2008 at 12:30:03PM -0400, Chris Moller wrote:
Extending ptrace seems like a sad idea.  If Linux is going to grow a
new userspace-accessible debug interface, can't it go in /proc or
something?
Actually, that's exactly what utracer does. It's a module that creates an entries under /proc (/proc/utracer/*) that client apps can read()/write()/ioctl() to access utracer capabilities. Maybe the coolest thing about utracer is that it gave every app its own /proc entry that blocked on read() until an app-defined "interesting" thing happened: specified signals, task state changes, specified syscall entry/exit, all the stuff accessible through utrace report_* callbacks.

So, how'd it demise in a way that a syscall interface would be any
better?  This sounds like the right way to do it (barring scaling
details; maintining one fd per thread becomes impractical).

No, utracer only required two fds per client app: two instances of a gdb-replacement, e.g., would require a total of four fds, regardless of how many threads each gbd-thing was following. The module was desiged to accecpt "client" requests from any number of apps and assign each it's pair of fds, (One fd was for write()ing various things to the module to control operations and ioctl()ing, mostly to extract synchronous data. The other fd was a read-only that blocked pending user-defined "interesting" stuff, kinda like a super waitpid().)

The main reason I'm moving away from this approach is that the overhead of read()/write()/ioctl() to/from a /proc pseudo-entry is a lot higher than a simple syscall. It's mostly a performance thing, but there's also less code tp maintain if I get rid of the /proc stuff. (Plus, I couldn't find any existing examples of anyone doing ioctl() to a /proc entry and I kinda had to invent the method myself. It works fine, but that may just be because I haven't found the right way to break it yet.)

Side note: every time someone talks about a ptrace replacement I
suggest stealing one from Solaris :-) It seems one of the areas that
Sun thought out properly, although in my limited brushes with it in
the last year I'm becoming less convinced of that.


What's Solaris ptrace() do that Linux ptrace() doesn't? Nothing says I can't at least hack at putting it in.

--
Chris Moller

 I know that you believe you understand what you think I said, but
 I'm not sure you realize that what you heard is not what I meant.
     -- Robert McCloskey


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to