From 8e9a8a487e942a090c791d91c152037724ef47f4 Mon Sep 17 00:00:00 2001 From: Yves Orton Date: Wed, 14 Jun 2006 16:33:24 +0200 Subject: [PATCH] Re: [PATCH] fix re debug segvs in global destruction, and a tweak to Benchmark to prevent infinite loops. (Re: ext/re/t/regop.pl SEGV) Message-ID: <9b18b3110606140533k583fdd3bh6c4b292e7ff4cf13@mail.gmail.com> p4raw-id: //depot/perl@28394 --- regcomp.c | 26 ++++++++++++-------------- regcomp.h | 6 +++--- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/regcomp.c b/regcomp.c index c1b4dc7..4514c19 100644 --- a/regcomp.c +++ b/regcomp.c @@ -3660,6 +3660,18 @@ reStudy: PerlIO_printf(Perl_debug_log,"Final program:\n"); regdump(r); }); + DEBUG_OFFSETS_r(if (r->offsets) { + const U32 len = r->offsets[0]; + U32 i; + GET_RE_DEBUG_FLAGS_DECL; + PerlIO_printf(Perl_debug_log, "Offsets: [%"UVuf"]\n\t", (UV)r->offsets[0]); + for (i = 1; i <= len; i++) { + if (r->offsets[i*2-1] || r->offsets[i*2]) + PerlIO_printf(Perl_debug_log, "%"UVuf":%"UVuf"[%"UVuf"] ", + i, (UV)r->offsets[i*2-1], (UV)r->offsets[i*2]); + } + PerlIO_printf(Perl_debug_log, "\n"); + }); return(r); } @@ -6359,20 +6371,6 @@ Perl_regdump(pTHX_ const regexp *r) if (r->reganch & ROPT_EVAL_SEEN) PerlIO_printf(Perl_debug_log, "with eval "); PerlIO_printf(Perl_debug_log, "\n"); - if (r->offsets) { - const U32 len = r->offsets[0]; - GET_RE_DEBUG_FLAGS_DECL; - DEBUG_OFFSETS_r({ - U32 i; - PerlIO_printf(Perl_debug_log, "Offsets: [%"UVuf"]\n\t", (UV)r->offsets[0]); - for (i = 1; i <= len; i++) { - if (r->offsets[i*2-1] || r->offsets[i*2]) - PerlIO_printf(Perl_debug_log, "%"UVuf":%"UVuf"[%"UVuf"] ", - i, (UV)r->offsets[i*2-1], (UV)r->offsets[i*2]); - } - PerlIO_printf(Perl_debug_log, "\n"); - }); - } #else PERL_UNUSED_CONTEXT; PERL_UNUSED_ARG(r); diff --git a/regcomp.h b/regcomp.h index 84a0e50..c81c286 100644 --- a/regcomp.h +++ b/regcomp.h @@ -616,14 +616,14 @@ re.pm, especially to the documentation. SV * re_debug_flags_sv = NULL; \ re_debug_flags_sv = get_sv(RE_DEBUG_FLAGS, 1); \ if (re_debug_flags_sv) { \ - if (!SvUOK(re_debug_flags_sv)) \ + if (!SvIOK(re_debug_flags_sv)) \ sv_setuv(re_debug_flags_sv, RE_DEBUG_COMPILE_DUMP | RE_DEBUG_EXECUTE_MASK ); \ - re_debug_flags=SvUV(re_debug_flags_sv); \ + re_debug_flags=SvIV(re_debug_flags_sv); \ }\ }) #ifdef DEBUGGING -#define GET_RE_DEBUG_FLAGS_DECL UV re_debug_flags = 0; GET_RE_DEBUG_FLAGS; +#define GET_RE_DEBUG_FLAGS_DECL IV re_debug_flags = 0; GET_RE_DEBUG_FLAGS; #else #define GET_RE_DEBUG_FLAGS_DECL #endif -- 2.7.4