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

Comparing Coro/Coro/Debug.pm (file contents):
Revision 1.16 by root, Mon Sep 24 18:29:47 2007 UTC vs.
Revision 1.17 by root, Tue Sep 25 01:47:23 2007 UTC

91 if ($cmd =~ /^ps/) { 91 if ($cmd =~ /^ps/) {
92 printf "%20s %s%s %4s %-24.24s %s\n", "pid", "S", "S", "RSS", "description", "where"; 92 printf "%20s %s%s %4s %-24.24s %s\n", "pid", "S", "S", "RSS", "description", "where";
93 for my $coro (Coro::State::list) { 93 for my $coro (Coro::State::list) {
94 Coro::cede; 94 Coro::cede;
95 my @bt; 95 my @bt;
96 $coro->_eval (sub { 96 Coro::State::call ($coro, sub {
97 # we try to find *the* definite frame that gives msot useful info 97 # we try to find *the* definite frame that gives msot useful info
98 # by skipping Coro frames and pseudo-frames. 98 # by skipping Coro frames and pseudo-frames.
99 for my $frame (1..10) { 99 for my $frame (1..10) {
100 my @frame = caller $frame; 100 my @frame = caller $frame;
101 @bt = @frame if $frame[2]; 101 @bt = @frame if $frame[2];
112 } 112 }
113 113
114 } elsif ($cmd =~ /bt\s+(\d+)/) { 114 } elsif ($cmd =~ /bt\s+(\d+)/) {
115 if (my $coro = find_coro $1) { 115 if (my $coro = find_coro $1) {
116 my $bt; 116 my $bt;
117 $coro->_eval (sub { $bt = Carp::longmess "coroutine is" }); 117 Coro::State::call ($coro, sub { $bt = Carp::longmess "coroutine is" });
118 if ($bt) { 118 if ($bt) {
119 print $bt; 119 print $bt;
120 } else { 120 } else {
121 print "$1: unable to get backtrace\n"; 121 print "$1: unable to get backtrace\n";
122 } 122 }
128 128
129 } elsif ($cmd =~ /eval\s+(\d+)\s+(.*)$/) { 129 } elsif ($cmd =~ /eval\s+(\d+)\s+(.*)$/) {
130 if (my $coro = find_coro $1) { 130 if (my $coro = find_coro $1) {
131 my $cmd = $2; 131 my $cmd = $2;
132 my @res; 132 my @res;
133 $coro->_eval (sub { @res = eval $cmd }); 133 Coro::State::call ($coro, sub { @res = eval $cmd });
134 print $@ ? $@ : (join " ", @res, "\n"); 134 print $@ ? $@ : (join " ", @res, "\n");
135 } 135 }
136 136
137 } elsif ($cmd =~ /^help/) { 137 } elsif ($cmd =~ /^help/) {
138 print <<EOF; 138 print <<EOF;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines