linux - perl's Devel::ebug how to -


first apologize if misunderstood whole concept of devel::ebug , how should used. want experiment devel::ebug perl module. here found example: what perl equivalent of bash -xv took following code , modified little bit. according official documentation devel::ebug cpan program method selects program load, thing i've changed.

#!/usr/bin/perl  use strict; use warnings; use devel::ebug; use data::dumper;  $ebug = devel::ebug->new; # $ebug->program(shift); # old value: $ebug->program($argv[0]); # new value:  $ebug->load;  until ($ebug->finished) {     print "+++ file:", $ebug->filename, " line: ", $ebug->line, "\n";     $pad = $ebug->pad;     $var (sort keys %$pad) {         if (ref $pad->{$var}) {             $line (split /\n/, data::dumper->dump([$pad->{$var}], [$var])) {                 print "++  $line\n";             }         } else {             print "++  $var = $pad->{$var}\n";         }     }     $line ($ebug->codelines($ebug->line-3 .. $ebug->line-1)) {         next unless defined $line;         print "+   $line\n";     }     print "+>  ", $ebug->codeline, "\n";     $line ($ebug->codelines($ebug->line+1 .. $ebug->line+3)) {         next unless defined $line;         print "+   $line\n";     }     $ebug->step; } 

then saved file as: stacktrace.pl in same directory have file: debugme.pl what perl equivalent of bash -xv page. instead of output mentioned on what perl equivalent of bash -xv page this:

> ./stacktrace.pl debugme.pl  ./stacktrace.pl: exec failed: no such file or directory  @ /home/wakatana/perl5/lib/perl5/devel/ebug.pm line 41 not connect: connection refused @ /home/wakatana/perl5/lib/perl5/devel/ebug.pm line 71. 

some further debugging pointed me this:

proc::background::unix::_new(/home/wakatana/perl5/lib/perl5/proc/background/unix.pm:47): 47:         if ($pid = fork()) {   db<7> s proc::background::unix::_new(/home/wakatana/perl5/lib/perl5/proc/background/unix.pm:49): 49:           $self->{_os_obj} = $pid; ######### forked, not know how create new tty. #########   since 2 debuggers fight same tty, input severely entangled.    know how switch output different window in xterms, os/2   consoles, , mac os x terminal.app only.  manual switch, put name   of created tty in $db::fork_tty, or define function   db::get_fork_tty() returning this.    on unix-like systems 1 can name of tty given window   typing tty, , disconnect shell tty sleep 1000000.  proc::background::unix::_new(/home/wakatana/perl5/lib/perl5/proc/background/unix.pm:54): 54:           exec @_ or croak "$0: exec failed: $!\n"; 

first assumed because run under gnu screen , somehow unable create new tty. not problem. missing here?

ps: seems problem occurs when working proc::background::unix module above output obtained using following debugger command:

b proc::background::unix::_new c 

edit: regarding @chankey pathak comment. issued commands under terminator. under xterm situation same:

> echo $$ 18548 > ps -elf | grep 18548 0 s wakatana    18548 18546  0  80   0 -  6296 -      16:09 pts/5    00:00:00 bash 0 r wakatana    18990 18548  0  80   0 -  4209 -      16:10 pts/5    00:00:00 ps -elf 0 r wakatana    18991 18548  0  80   0 -  1958 -      16:10 pts/5    00:00:00 grep 18548 > ps -elf | grep 18546 0 s wakatana    18546 18254  0  80   0 - 17220 -      16:09 pts/3    00:00:00 xterm 0 s wakatana    18548 18546  0  80   0 -  6296 -      16:09 pts/5    00:00:00 bash 0 r wakatana    19004 18548  0  80   0 -  1959 -      16:10 pts/5    00:00:00 grep 18546  > perl stacktrace.pl debugme.pl  stacktrace.pl: exec failed: no such file or directory  @ /home/wakatana/perl5/lib/perl5/devel/ebug.pm line 41 not connect: connection refused @ /home/wakatana/perl5/lib/perl5/devel/ebug.pm line 71. 

edit2: have cross-posted on perlmonks

okay, devel::ebug works this: there's controlling process listens on sockets (that's script pasted above) , "user interface" bit of debugger. there's script you're trying debug, controlling process launches , tells load devel::ebug debugger , script executes talks controlling script via sockets work out it's debbuging.

i think problem because controlling deve::ebug having issues executing program debug. looking around line 41 of devel::ebug see:

my $backend = $self->backend || "$bin/ebug_backend_perl"; $command = "$backend $program";; $proc = proc::background->new(   {'die_upon_destroy' => 1},   $command ); 

it looks ->backend should contain path that'll execute script right command line flags in order start in process debugger configured talk on sockets controlling program included above.

there's ebug_backend_perl installed module seems handle job you. think should $ebug->backend($path) (which if i'm guessing right /home/wakatana/perl5/bin/ebug_backend_perl on system) before calling $ebug->load


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -