… | |
… | |
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; |
… | |
… | |
174 | wl 'regex' print wrapped watchers matching the regex (or all if missing) |
195 | wl 'regex' print wrapped watchers matching the regex (or all if missing) |
175 | i id,... prints the watcher with the given ids in more detail |
196 | i id,... prints the watcher with the given ids in more detail |
176 | t enable tracing for newly created watchers (enabled by default) |
197 | t enable tracing for newly created watchers (enabled by default) |
177 | ut disable tracing for newly created watchers |
198 | ut disable tracing for newly created watchers |
178 | t id,... enable tracing for the given watcher (enabled by default) |
199 | t id,... enable tracing for the given watcher (enabled by default) |
179 | ut id,... disable tracing for the given weatcher |
200 | ut id,... disable tracing for the given watcher |
180 | w id,... converts the watcher ids to watcher objects (for scripting) |
201 | w id,... converts the watcher ids to watcher objects (for scripting) |
|
|
202 | coro xxx run xxx as Coro::Debug shell command, if available |
|
|
203 | coro switch to Coro::Debug shell, if available |
181 | EOF |
204 | EOF |
182 | } |
205 | } |
183 | |
206 | |
184 | sub wl(;$) { |
207 | sub wl(;$) { |
185 | my $re = @_ ? qr<$_[0]>i : qr<.>; |
208 | my $re = @_ ? qr<$_[0]>i : qr<.>; |