diff options
-rw-r--r-- | perl.h | 8 | ||||
-rw-r--r-- | pp_ctl.c | 16 |
2 files changed, 21 insertions, 3 deletions
@@ -5123,6 +5123,10 @@ typedef struct am_table_short AMTS; #define PERLDBf_NAMEEVAL 0x100 /* Informative names for evals */ #define PERLDBf_NAMEANON 0x200 /* Informative names for anon subs */ #define PERLDBf_SAVESRC 0x400 /* Save source lines into @{"_<$filename"} */ +#define PERLDBf_SAVESRC_NOSUBS 0x800 /* Including evals that generate no subrouties */ +#if 0 /* Not yet working. */ +#define PERLDBf_SAVESRC_INVALID 0x1000 /* Save source that did not compile */ +#endif #define PERLDB_SUB (PL_perldb && (PL_perldb & PERLDBf_SUB)) #define PERLDB_LINE (PL_perldb && (PL_perldb & PERLDBf_LINE)) @@ -5136,6 +5140,10 @@ typedef struct am_table_short AMTS; #define PERLDB_NAMEANON (PL_perldb && (PL_perldb & PERLDBf_NAMEANON)) #define PERLDB_SAVESRC (PL_perldb && (PL_perldb & PERLDBf_SAVESRC)) +#define PERLDB_SAVESRC_NOSUBS (PL_perldb && (PL_perldb & PERLDBf_SAVESRC_NOSUBS)) +#if 0 /* Not yet working. */ +#define PERLDB_SAVESRC_INVALID (PL_perldb && (PL_perldb & PERLDBf_SAVESRC_INVALID)) +#endif #ifdef USE_LOCALE_NUMERIC @@ -3549,9 +3549,19 @@ PP(pp_entereval) MUTEX_UNLOCK(&PL_eval_mutex); #endif /* USE_5005THREADS */ ok = doeval(gimme, NULL, runcv, seq); - if ((PERLDB_LINE || PERLDB_SAVESRC) - && was != (I32)PL_sub_generation /* Some subs defined here. */ - && ok) { + if (ok ? (was != (I32)PL_sub_generation /* Some subs defined here. */ + ? (PERLDB_LINE || PERLDB_SAVESRC) + : PERLDB_SAVESRC_NOSUBS) + : 0 /* PERLDB_SAVESRC_INVALID */ + /* Much that I'd like to think that it was this trivial to add this + feature, it's not, due to + lex_end(); + LEAVE; + in S_doeval() for the failure case. So really we want a more + sophisticated way of (optionally) clearing the source code. + Particularly as the current way is buggy, as a syntactically + invalid eval string can still define a subroutine that is retained, + and the user may wish to breakpoint. */) { /* Copy in anything fake and short. */ my_strlcpy(safestr, fakestr, fakelen); } |