bsb has asked for the wisdom of the Perl Monks concerning the following question:

I was checking something with the debugger and a typo made the debugger actually hang, ignoring ^C. Originally the "whatever" below was a call to a sub I'd defined but "//" or "chop" produce the same behaviour.

Does it hang for anyone else?
Why is it hanging?

$ perl -de 1 [...] DB<1> ($a,b) = whatever Terminated # I have to kill it
I'm using v5.6.1 built for i386-linux.

Update:

$ ltrace output stops in a free..? free(0x082004f0) = <void> free(0x081054d0) = <void> free(0x08119288) = <void> free(0x0832cf98 <unfinished ...>

Replies are listed 'Best First'.
Re: perl -d hanging on some input
by jeffa (Bishop) on Feb 27, 2004 at 01:53 UTC

    [jeffa@junk-box jeffa]$ perl -de 1 [...] DB<1> ($a,$b) = chop($c='hello'); DB<2> print join'-',$a,$b; o- DB<3> ($a,$b) = 'hello' =~ /(he)(l{2}o)/; DB<4> print join'-',$a,$b; he-llo
    No problems for me (v5.6.1 built for i386-linux) ... i think we are going to need more info ...

    UPDATE: yep ... time to get my eyes examined ... bsb, when i ran the second i received a shiny Signal SEGV :/

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
      The critical difference:
      ($a,$b) = chop($c='hello'); # $b ($a, b) = chop($c='hello'); # just b -> hang
      Please try the second and let me know what happens.
Re: perl -d hanging on some input
by BrowserUk (Patriarch) on Feb 27, 2004 at 02:18 UTC

    It's probably a typo, and I can't see how it would produce the effect you describe anyway, but you have a bare word in your list assignment. ($a,b) = ....

    That gives me

    DB<2> ($a,b) = chop Can't modify constant item in list assignment at (eval 6)[c DB<3>

    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    Timing (and a little luck) are everything!
      Which version/platform?

      The "($a,b) = chop" test hangs for me.

      Note also that these work fine:

      perl -e '($a,b) = chop' perl -de '($a,b) = chop' # the pressing "c" to continue
        P:\test>perl -v This is perl, v5.8.2 built for MSWin32-x86-multi-thread (with 25 registered patches, see perl -V for more detail) Copyright 1987-2003, Larry Wall Binary build 808 provided by ActiveState Corp. http://www.ActiveState. +com ActiveState is a division of Sophos. Built Dec 9 2003 10:19:40 Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using `man perl' or `perldoc perl'. If you have access to + the Internet, point your browser at http://www.perl.com/, the Perl Home Pa +ge. P:\test>perl -de1 Loading DB routines from perl5db.pl version 1.22 Editor support available. Enter h or `h h' for help, or `perldoc perldebug' for more help. main::(-e:1): 1 DB<1> ($a,b) = chop Can't modify constant item in list assignment at (eval 5)[c:/Perl/lib/ +perl5db.pl:618] line 2, at EOF DB<2>

        Examine what is said, not who speaks.
        "Efficiency is intelligent laziness." -David Dunham
        "Think for yourself!" - Abigail
        Timing (and a little luck) are everything!
        works fine for me too...
        [osx:share/mysql/sql-bench] me% perl -V Summary of my perl5 (revision 5.0 version 8 subversion 1 RC3) configur +ation: Platform: osname=darwin, osvers=7.0, archname=darwin-thread-multi-2level uname='darwin hampsten 7.0 darwin kernel version 6.0: fri jul 25 1 +6:58:41 pdt 2003; root:xnu-344.frankd.rootsxnu-344.frankd~objrelease_ +ppc power macintosh powerpc ' config_args='-ds -e -Dprefix=/usr -Dccflags=-g -pipe -Dldflags=- +Dman3ext=3pm -Duseithreads -Duseshrplib' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemulti +plicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-g -pipe -pipe -fno-common -DPERL_DARWIN -no-cp +p-precomp -fno-strict-aliasing -I/usr/local/include', ...
        main::(-e:1): 1 DB<1> ($a,b) = chop Can't modify constant item in list assignment at (eval 5)[/System/Libr +ary/Perl/5.8.1/perl5db.pl:618] line 2, at EOF


        -Waswas