ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/lib/AnyEvent/Debug.pm
(Generate patch)

Comparing AnyEvent/lib/AnyEvent/Debug.pm (file contents):
Revision 1.40 by root, Mon Apr 9 02:25:48 2012 UTC vs.
Revision 1.42 by root, Thu Dec 13 02:33:26 2012 UTC

130 130
131 AnyEvent::Util::fh_nonblocking $fh, 0; 131 AnyEvent::Util::fh_nonblocking $fh, 0;
132 132
133 if ($line =~ /^\s*exit\b/) { 133 if ($line =~ /^\s*exit\b/) {
134 syswrite $fh, "sorry, no... if you want to execute exit, try CORE::exit.\015\012"; 134 syswrite $fh, "sorry, no... if you want to execute exit, try CORE::exit.\015\012";
135 } elsif ($line =~ /^\s*coro\b\s*(.*)/) {
136 my $arg = $1;
137 if (eval { require Coro; require Coro::Debug }) {
138 if ($arg =~ /\S/) {
139 Coro::async (sub {
140 select $fh;
141 Coro::Debug::command ($arg);
142 local $| = 1; # older Coro versions do not flush
143 syswrite $fh, "> ";
144 });
145 return;
146 } else {
147 undef $rw;
148 syswrite $fh, "switching to Coro::Debug...\015\012";
149 Coro::async (sub { Coro::Debug::session ($fh) });
150 return;
151 }
152 } else {
153 syswrite $fh, "Coro not available.\015\012";
154 }
155
135 } else { 156 } else {
136 package AnyEvent::Debug::shell; 157 package AnyEvent::Debug::shell;
137 158
138 no strict 'vars'; 159 no strict 'vars';
139 local $LOGGER = $logger; 160 local $LOGGER = $logger;
174wl 'regex' print wrapped watchers matching the regex (or all if missing) 195wl 'regex' print wrapped watchers matching the regex (or all if missing)
175i id,... prints the watcher with the given ids in more detail 196i id,... prints the watcher with the given ids in more detail
176t enable tracing for newly created watchers (enabled by default) 197t enable tracing for newly created watchers (enabled by default)
177ut disable tracing for newly created watchers 198ut disable tracing for newly created watchers
178t id,... enable tracing for the given watcher (enabled by default) 199t id,... enable tracing for the given watcher (enabled by default)
179ut id,... disable tracing for the given weatcher 200ut id,... disable tracing for the given watcher
180w id,... converts the watcher ids to watcher objects (for scripting) 201w id,... converts the watcher ids to watcher objects (for scripting)
202coro xxx run xxx as Coro::Debug shell command, if available
203coro switch to Coro::Debug shell, if available
181EOF 204EOF
182 } 205 }
183 206
184 sub wl(;$) { 207 sub wl(;$) {
185 my $re = @_ ? qr<$_[0]>i : qr<.>; 208 my $re = @_ ? qr<$_[0]>i : qr<.>;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines