diff options
author | Yves Orton <demerphq@gmail.com> | 2016-03-11 10:36:25 +0100 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2016-03-13 12:39:23 +0100 |
commit | cb41e5d6f2193df9fd06cf60a96285694ec458ba (patch) | |
tree | 3c3d1c14ff4fa8705920eaeb1ab6378977d4948c /embed.fnc | |
parent | febe9c7a66e3a16aba6a75e5550c8005ecb52f10 (diff) | |
download | perl-cb41e5d6f2193df9fd06cf60a96285694ec458ba.tar.gz |
Rework diagnostics in the regex engine
This introduces three new subs:
Perl_re_printf() which is a wrapper for
PerlIO_printf( Perl_debug_log, ... ),
which cuts down on clutter in the code. Arguably this could be moved
to util.c and renamed something like PerlIO_debugf() and then we could
declutter all the statements that write to the Perl_debug_log
filehandle. But that is a bit too ambituous for me right now, so
I leave this as a regex engine only sub for now.
Perl_re_indentf() which is a wrapper for PerlIO_re_printf(),
which adds an indent argument and automatically indents the
line appropriately, and is used in regcomp.c for trace diagnostics
during compilation.
Perl_re_indentfo() which is similar to Perl_re_indentf() but
is used in regexec.c which adds a specific prefix to each indented
line to account for the fact that during execution we normally have
string position information on the left.
The end result of this patch is that a lot of clutter in the debugging
statements in the regex engine is reduced, exposing what is actually
going on. It should also now be easier to add new diagnostics which
"do the right thing".
Over time the debugging trace output in regexec has become
very cluttered and confusing. This patch cleans much of it up,
if something happens at a given recursion depth it is output
at the right depth, etc, and formats have been changed to not have
leading spaces so you can actually see the indentation properly.
Diffstat (limited to 'embed.fnc')
-rw-r--r-- | embed.fnc | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -2118,6 +2118,7 @@ p |OP * |tied_method|NN SV *methname|NN SV **sp \ #if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) Ep |void |regprop |NULLOK const regexp *prog|NN SV* sv|NN const regnode* o|NULLOK const regmatch_info *reginfo \ |NULLOK const RExC_state_t *pRExC_state +Epno |int |re_printf |NN const char *fmt|... #endif #if defined(PERL_IN_REGCOMP_C) Es |regnode*|reg |NN RExC_state_t *pRExC_state \ @@ -2264,6 +2265,7 @@ EnPs |int |edit_distance |NN const UV *src \ |const STRLEN y \ |const SSize_t maxDistance # ifdef DEBUGGING +Epno |int |re_indentf |NN const char *fmt|U32 depth|... Es |void |regdump_intflags|NULLOK const char *lead| const U32 flags Es |void |regdump_extflags|NULLOK const char *lead| const U32 flags Es |const regnode*|dumpuntil|NN const regexp *r|NN const regnode *start \ @@ -2375,10 +2377,12 @@ EsR |WB_enum|backup_one_WB |NN WB_enum * previous \ |const bool utf8_target # ifdef DEBUGGING Es |void |dump_exec_pos |NN const char *locinput|NN const regnode *scan|NN const char *loc_regeol\ - |NN const char *loc_bostr|NN const char *loc_reg_starttry|const bool do_utf8 + |NN const char *loc_bostr|NN const char *loc_reg_starttry|const bool do_utf8|U32 depth Es |void |debug_start_match|NN const REGEXP *prog|const bool do_utf8\ |NN const char *start|NN const char *end\ |NN const char *blurb + +Epno |int |re_indentfo |NN const char *fmt|U32 depth|... # endif #endif |