develooper Front page | perl.perl5.porters | Postings from April 2007

debugging with read only OPs

Thread Next
From:
Nicholas Clark
Date:
April 12, 2007 12:07
Subject:
debugging with read only OPs
Message ID:
20070412190719.GK69960@plum.flirble.org
Having found the last few bugs (hopefully) it now seems that every SIGBUS
from building -DPL_OP_SLAB_ALLOC -DPERL_DEBUG_READONLY_OPS shares a common
pattern. I see these test failures on FreeBSD

../ext/B/t/concise-xs.t                    0    11  1617 1566  835-1617
../ext/B/t/optree_constants.t              0    11    ??   ??  ??
../ext/Data/Dumper/t/dumper.t              0    11    ??   ??  ??
../ext/Devel/PPPort/t/newCONSTSUB.t        0    11     3    6  1-3
../ext/IO/t/IO.t                           0    11    ??   ??  ??
../ext/POSIX/t/sigaction.t                 0    11    31   12  26-31
../ext/Sys/Syslog/t/syslog.t               0    11   159  318  1-159
../lib/CPANPLUS/t/20_CPANPLUS-Dist-MM.t  255 65280    41    6  9-10 12 15-16 40
../lib/ExtUtils/t/00compile.t              0    11    98  128  35-98
../lib/ExtUtils/t/Constant.t              11  2816   302  603  1-302
../lib/ExtUtils/t/FIRST_MAKEFILE.t         3   768     7    3  3-5
../lib/ExtUtils/t/INST.t                   0    11    26   48  3-26
../lib/ExtUtils/t/INSTALL_BASE.t          17  4352    21   17  3-19
../lib/ExtUtils/t/INST_PREFIX.t            0    11    52  100  3-52
../lib/ExtUtils/t/Install.t                0    11    33   54  7-33
../lib/ExtUtils/t/PL_FILES.t               6  1536     9    6  2-7
../lib/ExtUtils/t/VERSION_FROM.t           0    11     1    2  1
../lib/ExtUtils/t/basic.t                 69 17664    80   69  3-4 6-55 57-59
                                                               61-67 69 71 73-
                                                               74 76-78
../lib/ExtUtils/t/build_man.t              0    11     9   12  4-9
../lib/ExtUtils/t/pm.t                     0    11     6    6  4-6
../lib/ExtUtils/t/postamble.t              0    11     8   12  3-8
../lib/ExtUtils/t/recurs.t                12  3072    25   12  3-6 11-12 14 19-
                                                               23
../lib/ExtUtils/t/split_command.t          0    11     7   14  1-7
../lib/ExtUtils/t/writemakefile_args.t     0    11    16   26  4-16
../lib/File/Fetch/t/01_File-Fetch.t        0    11    ??   ??  ??
../lib/File/Temp/t/security.t              0    11    13   16  6-13
../lib/Module/Build/t/compat.t             8  2048    60    8  23-30
../lib/Module/Build/t/install.t            0    11    34   66  2-34
../lib/Net/t/require.t                     0    11    ??   ??  ??
../lib/perl5db.t                                       1    1  1
lib/proxy_constant_subs.t                  0    11     8    8  5-8
op/gv.t                                    0    11   160  156  83-160

(same on Linux, but the SIGBUSes are SEGVs)

and for every one I can stick a debugger on, I get:

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x82b80dc, name=0x0,
    sv=0x82f50cc) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x839cd8c,
    name=0x82aadb3 "SEEK_SET", sv=0x83d3b6c) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x83587ac,
    name=0x2846eba3 "POLLIN", sv=0x835895c) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x862116c,
    name=0x287e1747 "W_OK", sv=0x86fa3cc) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x83928ec,
    name=0x28511751 "_PC_CHOWN_RESTRICTED", sv=0x83dc5dc) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x83b06fc,
    name=0x284e6ba3 "POLLIN", sv=0x83b08ac) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x84bc25c,
    name=0x28616fd2 "ARG_MAX", sv=0x85727dc) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x846e5dc,
    name=0x285d1fd2 "ARG_MAX", sv=0x85059fc) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x84ba46c,
    name=0x28616fd2 "ARG_MAX", sv=0x857344c) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x84bc25c,
    name=0x28616fd2 "ARG_MAX", sv=0x856f4cc) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x84bc25c,
    name=0x28616fd2 "ARG_MAX", sv=0x85708ac) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x84b469c,
    name=0x285d5fd2 "ARG_MAX", sv=0x850ce7c) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x83b1a2c,
    name=0x2858f747 "W_OK", sv=0x844b47c) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x84bc46c,
    name=0x2861efd2 "ARG_MAX", sv=0x854d21c) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x84bb46c,
    name=0x2861afd2 "ARG_MAX", sv=0x857298c) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x84c058c,
    name=0x285d6ba3 "POLLIN", sv=0x84c073c) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x82b80dc, name=0x0,
    sv=0x839a6ec) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x82b80dc,
    name=0x830aab2 "SA_SIGINFO", sv=0x83140dc) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x83a196c,
    name=0x837e2de "INADDR_ANY", sv=0x83ad5ac) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x8330aec,
    name=0x28472e20 "test_value_1", sv=0x833edcc) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x8323c4c,
    name=0x284da3b1 "CVf_ANON", sv=0x83b423c) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x82b80dc,
    name=0x82ebd60 "myaref", sv=0x83e5c3c) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);

Program received signal SIGBUS, Bus error.
0x08071b0b in Perl_newCONSTSUB (my_perl=0x82b6000, stash=0x85b008c,
    name=0x837e15e "INADDR_ANY", sv=0x85b307c) at op.c:5669
5669        CopLINE_set(PL_curcop, PL_copline);



You may be spotting a pattern here :-)

It's this part of newCONSTSUB:

    SAVECOPLINE(PL_curcop);
    CopLINE_set(PL_curcop, PL_copline);

PL_curcop is pointing to an existing op, which is (rightly) read only.

In turn, all that setting appears to be just for this possibility of a warning
deep in newXS:

	    if (ckWARN(WARN_REDEFINE)) {
		GV * const gvcv = CvGV(cv);
		if (gvcv) {
		    HV * const stash = GvSTASH(gvcv);
		    if (stash) {
			const char *redefined_name = HvNAME_get(stash);
			if ( strEQ(redefined_name,"autouse") ) {
			    const line_t oldline = CopLINE(PL_curcop);
			    if (PL_copline != NOLINE)
				CopLINE_set(PL_curcop, PL_copline);
			    Perl_warner(aTHX_ packWARN(WARN_REDEFINE),
					CvCONST(cv) ? "Constant subroutine %s redefined"
						    : "Subroutine %s redefined"
					,name);
			    CopLINE_set(PL_curcop, oldline);
			}
		    }
		}
	    }


Surely there's a better way to pass in line number information, or write it
to some non-volatile op?

Nicholas Clark

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About