Update:
CPAN informs me I've committed a faux pas:
the IPC::Mmap namespace has been registered to someone
else, but no module ever uploaded. <sigh/> So I'll
likely need to revise these packages a bit in the next
few days.
Update 2:
I'm saved! The owner of "IPC::Mmap" has agreed to turn it over to me. Many thanks for the assistance of the
good keepers of CPAN/PAUSE for their help.
On top of that foundation, Devel::RingBuffer implements a set of ringbuffers, plus some command/control structures. Devel::STrace supplies multithread/multiprocess friendly implementations of DB::DB() and DB::sub(), such that each thread of each process gets its own ringbuffer and command/control structure. Locking is minimized (I call it "cavalier concurrency control"), and much of the code is XS/C to minimize performance impact (though the impact is still significant, comparable to running with "-d" in NonStop mode).
A Devel::STrace::Monitor package is also provided to permit external monitoring applications to access the ringbuffers, and , finally, a small monitor script, plstrace.pl, implements the monitor application which attaches to the monitored application and dumps out the current ringbuffer contents at specified intervals.
E.g., to monitor an application:
which will dump the name of the ringbuffer file/namespace to STDERR upon creation; that name is then plugged intoperl -d:STrace someapp.pl
which will print the current ring buffer contents every <sample> seconds for <duration>. (There are numerous tuning parameters set via environment variables; refer to the package docs for details)plstrace.pl -s <sample> -d <duration> -f <file>
As a first release, there remain some holes:
Perhaps as importantly, along the way I realized that this substrate provided intriguing possibilities for developing decoupled, multithreaded/multiprocess-friendly debuggers...
As I started developing the ringbuffer structures for Devel::STrace, I realized it would be a simple matter of adding some command/control hooks that can be used to build debuggers which run nearly entirely separately from the debugged application. With such hooks, it would be possible to
If you've ever peered into perl5db.pl, or ptkdb, you'll realize how "intimate" those debuggers are with the debugged app. Devel::RingBuffer plus an appropriate derivative of Devel::STrace break that tight coupling, thus permitting, e.g., a Perl/Tk debugger GUI app to attach to a running Gtk perl app, debug as needed, and then detach to let the application run. (Hopefully, this solution could apply to CGI or mod_perl apps as well ?). And, unlike Devel::ebug, which relies on TCP sockets communications between debugger and debugged app, the command/control interface is as simple - and fast - as reading a few bytes of memory.
Update:
It appears an attachable debugger may have
some supporters; wish I had the time...
Alas, my spare cycles for the effort of implementing these notions are currently at a premium. Any volunteers ?
|
---|