From: Jim C. <jc...@di...> - 2002-11-20 23:38:06
Attachments:
expect-prob
|
on linux RH-72 w current 2.4.18 When trying to debug my cruft (elided), I had a consistent problem hooking up to spawned process under the debugger. Ive 'reduced' it to a test-case that doesnt involve any of my stuff :-) The hang under debugger is the same. fia - if this is well known debugger option twizzle.. [root@harpo .cpan/build/Expect-1.15]# perl -d test.pl ... on tests 16, 18not ok 16 # Test failed at test.pl line 86. some string ok 17 not ok 18 # Test failed at test.pl line 95. Testing -notransfer... X some other ok 19 ... ok 24 Testing raw reversing... isatty($exp): YES I control C here, to break hang. Expect::spawn(/usr/local/lib/perl5/site_perl/5.8.0/Expect.pm:125): 125: die "Cannot sync with child: $!" if not defined $errstatus; DB<1> c Cannot sync with child: Interrupted system call at /usr/local/lib/perl5/site_perl/5.8.0/Expect.pm line 125. Expect::spawn('Expect=GLOB(0x860c208)','/usr/local/bin/perl -ne \'chomp; sleep 0; print scalar revers...') called at test.pl line 162 Debugged program terminated. Use q to quit or R to restart, use O inhibit_exit to avoid stopping after program termination, h q, h R or h O to get additional info. DB<1> q [root@harpo Expect-1.15]# a script capture is also attached unedited, but -pi -e's/\r//' cleaned. tia, jimc [root@harpo Expect-1.15]# perl -V Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration: Platform: osname=linux, osvers=2.4.18-12.5, archname=i686-linux uname='linux harpo.jimc.earth 2.4.18-12.5 #1 mon aug 26 08:51:52 edt 2002 i686 unknown ' config_args='-des -Accflags=-DDEBUGGING' hint=previous, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -DDEBUGGING -DDEBUGGING', optimize='-O2', cppflags='-fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -DDEBUGGING -DDEBUGGING' ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.2 2.96-108.7.2)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='gcc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lgdbm -ldb -ldl -lm -lc -lcrypt -lutil perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil libc=/lib/libc-2.2.4.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.2.4' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: DEBUGGING USE_LARGE_FILES Built under linux Compiled at Sep 20 2002 03:36:26 @INC: /usr/local/lib/perl5/5.8.0/i686-linux /usr/local/lib/perl5/5.8.0 /usr/local/lib/perl5/site_perl/5.8.0/i686-linux /usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/site_perl . |
From: Jim C. <jc...@di...> - 2002-12-11 20:58:34
|
Jim Cromie wrote: sorry to reply to myself, but this "bug" should be easily repeatable (or not) on your respective systems. Id like to know if this is a PEBCAK error (problem exists between chair and keyboard :-) thanks in advance. > > on linux RH-72 w current 2.4.18 > > When trying to debug my cruft (elided), > I had a consistent problem hooking up to spawned process under the > debugger. > > Ive 'reduced' it to a test-case that doesnt involve any of my stuff :-) > The hang under debugger is the same. > > forgive in advance if this is well known debugger option twizzle.. manually testing from my CPAN build directory, using the distributed test.pl, > > [root@harpo .cpan/build/Expect-1.15]# perl -d test.pl > > ... > on tests 16, 18not ok 16 > # Test failed at test.pl line 86. > some string > ok 17 > not ok 18 > # Test failed at test.pl line 95. > > Testing -notransfer... > > X some other > ok 19 > ... > ok 24 > > Testing raw reversing... > > isatty($exp): YES > > > I control C here, to break hang. > > > Expect::spawn(/usr/local/lib/perl5/site_perl/5.8.0/Expect.pm:125): > 125: die "Cannot sync with child: $!" if not defined $errstatus; > DB<1> c > Cannot sync with child: Interrupted system call at > /usr/local/lib/perl5/site_perl/5.8.0/Expect.pm line 125. > Expect::spawn('Expect=GLOB(0x860c208)','/usr/local/bin/perl -ne > \'chomp; sleep 0; print scalar revers...') called at test.pl line 162 > Debugged program terminated. Use q to quit or R to restart, > use O inhibit_exit to avoid stopping after program termination, > h q, h R or h O to get additional info. DB<1> q > [root@harpo Expect-1.15]# > > > > a script capture is also attached unedited, but -pi -e's/\r//' cleaned. > > tia, jimc > > > [root@harpo Expect-1.15]# perl -V > Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration: > Platform: > osname=linux, osvers=2.4.18-12.5, archname=i686-linux > uname='linux harpo.jimc.earth 2.4.18-12.5 #1 mon aug 26 08:51:52 > edt 2002 i686 unknown ' > config_args='-des -Accflags=-DDEBUGGING' > hint=previous, useposix=true, d_sigaction=define > usethreads=undef use5005threads=undef useithreads=undef > usemultiplicity=undef > useperlio=define d_sfio=undef uselargefiles=define usesocks=undef > use64bitint=undef use64bitall=undef uselongdouble=undef > usemymalloc=n, bincompat5005=undef > Compiler: > cc='gcc', ccflags ='-fno-strict-aliasing -I/usr/local/include > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm > -DDEBUGGING -DDEBUGGING', > optimize='-O2', > cppflags='-fno-strict-aliasing -I/usr/local/include > -I/usr/include/gdbm -fno-strict-aliasing -I/usr/local/include > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm > -DDEBUGGING -fno-strict-aliasing -I/usr/local/include > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm > -DDEBUGGING -DDEBUGGING' > ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.2 > 2.96-108.7.2)', gccosandvers='' > intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 > d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 > ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', > lseeksize=8 > alignbytes=4, prototype=define > Linker and Libraries: > ld='gcc', ldflags =' -L/usr/local/lib' > libpth=/usr/local/lib /lib /usr/lib > libs=-lnsl -lgdbm -ldb -ldl -lm -lc -lcrypt -lutil > perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil > libc=/lib/libc-2.2.4.so, so=so, useshrplib=false, libperl=libperl.a > gnulibc_version='2.2.4' > Dynamic Linking: > dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' > cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' > > > Characteristics of this binary (from libperl): > Compile-time options: DEBUGGING USE_LARGE_FILES > Built under linux > Compiled at Sep 20 2002 03:36:26 > @INC: > /usr/local/lib/perl5/5.8.0/i686-linux > /usr/local/lib/perl5/5.8.0 > /usr/local/lib/perl5/site_perl/5.8.0/i686-linux > /usr/local/lib/perl5/site_perl/5.8.0 > /usr/local/lib/perl5/site_perl > . > >------------------------------------------------------------------------ > >Script started on Wed Nov 20 16:17:36 2002 > > > > >[root@harpo Expect-1.15]# perl -d test.pl > >Loading DB routines from perl5db.pl version 1.19 >Editor support available. > >Enter h or `h h' for help, or `man perldebug' for more help. > >1..36 >main::(test.pl:3): $^W = 1; # warnings too >[4m DB<1> [24mc > >Basic tests... > >ok 1 >ok 2 >ok 3 >ok 4 > >Testing exec failure... > >ok 5 >Can't exec "Ignore_This_Error_Its_A_Test__efluna3w6868tn8": No such file or directory at /usr/local/lib/perl5/site_perl/5.8.0/Expect.pm line 153. > Expect::spawn('Expect=GLOB(0x85a7a50)','Ignore_This_Error_Its_A_Test__efluna3w6868tn8') called at test.pl line 49 >Cannot exec(Ignore_This_Error_Its_A_Test__efluna3w6868tn8): > Expect::spawn('Expect=GLOB(0x85a7a50)','Ignore_This_Error_Its_A_Test__efluna3w6868tn8') called at test.pl line 49 >ok 6 >not ok 7 ># Test failed at test.pl line 50. >ok 8 > >Testing exp_continue... > >A >B >C >D >End >ok 9 >ok 10 >ok 11 >ok 12 >ok 13 >Begin >End >ok 14 >ok 15 >not ok 16 ># Test failed at test.pl line 86. >some string >ok 17 >not ok 18 ># Test failed at test.pl line 95. > >Testing -notransfer... > >X some other >ok 19 >ok 20 >ok 21 >ok 22 >ok 23 >EOF >ok 24 > >Testing raw reversing... > >isatty($exp): YES >Expect::spawn(/usr/local/lib/perl5/site_perl/5.8.0/Expect.pm:125): >125: die "Cannot sync with child: $!" if not defined $errstatus; >[4m DB<1> [24mc >Cannot sync with child: Interrupted system call at /usr/local/lib/perl5/site_perl/5.8.0/Expect.pm line 125. > Expect::spawn('Expect=GLOB(0x860c208)','/usr/local/bin/perl -ne \'chomp; sleep 0; print scalar revers...') called at test.pl line 162 >Debugged program terminated. Use q to quit or R to restart, > use O inhibit_exit to avoid stopping after program termination, > h q, h R or h O to get additional info. >[4m DB<1> [24mq >]0;root@harpo:/usr/local/cpan/build/Expect-1.15[root@harpo Expect-1.15]# >Script done on Wed Nov 20 16:22:30 2002 > > |
From: Roland G. <RGI...@cp...> - 2002-12-14 19:40:02
|
Sorry for replying so late... >> When trying to debug my cruft (elided), >> I had a consistent problem hooking up to spawned process under the >> debugger. Well, debugging programs that fork is not easy, and even binary debuggers have their problems with such a case. It gets even worse for the perl debugger: when the perl interpreter forks, it also means that the debugger forks, in fact you are then dealing with two independent debuggers that don't know of each other, but continue to share their various filedescriptors, namely STDIN. So the parent process now sees not the child it expects to, but the child-behind-a-debugger, which may and often does result in confusion. I don't think there is really a solution for that problem, apart from "if that hurts, don't do that". Oh, and that's why I'm trying to discourage the use of Expect (well, actually IO::Tty) and point to other solutions, e.g. Net::Telnet instead of spawning a telnet client. Expect still can be used with Net::Telnet, but without the overhead of spawning another process. There is even a pure-perl implementation of ssh, but unfortunately without a filedescriptor-interface that is usable with Expect... This leaves the good olde, but not very powerful debug-with-print... Sorry that I cannot be of more help. Roland |
From: Jim C. <jc...@di...> - 2002-12-27 16:52:06
|
Roland Giersig wrote: > Sorry for replying so late... No problem - thanks for responding In case its not clear (and it appears that it was clear - or at least that you understood me - I just want to be sure) Im explicitly *not* trying to debug Expect or the external program it spawns, I want to avoid the debugger in the middle problem, and was hoping that I was insufficiently clever to have understood the debugger option that would suppress the sub-process' debugger. From what youve said, it would not be enough for the forked debugger to run in non-stop mode. So, Im thinking about trying to pre-spawn the external program, then attaching to it with my (modified) perl-prog under the debugger. Do you have any quick tips or advice wrt this approach ? tia jimc > > >> When trying to debug my cruft (elided), > >> I had a consistent problem hooking up to spawned process under the > >> debugger. > > Well, debugging programs that fork is not easy, and even binary > debuggers have their problems with such a case. It gets even worse for > the perl debugger: when the perl interpreter forks, it also means that > the debugger forks, in fact you are then dealing with two independent > debuggers that don't know of each other, but continue to share their > various filedescriptors, namely STDIN. So the parent process now sees > not the child it expects to, but the child-behind-a-debugger, which > may and often does result in confusion. > > I don't think there is really a solution for that problem, apart from > "if that hurts, don't do that". > > Oh, and that's why I'm trying to discourage the use of Expect (well, > actually IO::Tty) and point to other solutions, e.g. Net::Telnet > instead of spawning a telnet client. Expect still can be used with > Net::Telnet, but without the overhead of spawning another process. > There is even a > pure-perl implementation of ssh, but unfortunately without a > filedescriptor-interface that is usable with Expect... > > This leaves the good olde, but not very powerful debug-with-print... > > Sorry that I cannot be of more help. > > Roland > > > > ------------------------------------------------------- > This sf.net email is sponsored by: > With Great Power, Comes Great Responsibility Learn to use your power > at OSDN's High Performance Computing Channel > http://hpc.devchannel.org/ > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > > . > |
From: Jim C. <jc...@di...> - 2002-12-27 17:41:37
|
Jim Cromie wrote: > > > In case its not clear (and it appears that it was clear - or at least > that you understood me - I just want to be sure) > Im explicitly *not* trying to debug Expect or the external program it > spawns, > > one other thing - reviewing my (old) code - I found that I had added a cmd-line option to set $DB::single = 1 at a certain point in the Expect interaction. This jogged my memory - that I was once able to do this (ie the debugger stopped at that point), so it must have gotten past the hang-on-startup that prompted these questions. thx again, |