diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-07-21 13:41:44 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-07-21 13:41:44 +0100 |
commit | 5b235299a82969c391c126a8d9a1475362a595a6 (patch) | |
tree | d28ceb65a7917eb3270c3b5389b97a4709174e3d /perl.c | |
parent | 710891042a142a482afd4eed1f3b1feb27a9c504 (diff) | |
download | perl-5b235299a82969c391c126a8d9a1475362a595a6.tar.gz |
Add Perl_init_dbargs(), to set up @DB::args without losing SV references.
Diffstat (limited to 'perl.c')
-rw-r--r-- | perl.c | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -3774,15 +3774,30 @@ S_forbid_setid(pTHX_ const char flag, const bool suidscript) /* g */ } void +Perl_init_dbargs(pTHX) +{ + AV *const args = PL_dbargs = GvAV(gv_AVadd((gv_fetchpvs("DB::args", + GV_ADDMULTI, + SVt_PVAV)))); + + if (AvREAL(args)) { + /* Someone has already created it. + It might have entries, and if we just turn off AvREAL(), they will + "leak" until global destruction. */ + av_clear(args); + } + AvREAL_off(PL_dbargs); /* XXX should be REIFY (see av.h) */ +} + +void Perl_init_debugger(pTHX) { dVAR; HV * const ostash = PL_curstash; PL_curstash = PL_debstash; - PL_dbargs = GvAV(gv_AVadd((gv_fetchpvs("DB::args", GV_ADDMULTI, - SVt_PVAV)))); - AvREAL_off(PL_dbargs); + + Perl_init_dbargs(aTHX); PL_DBgv = gv_fetchpvs("DB::DB", GV_ADDMULTI, SVt_PVGV); PL_DBline = gv_fetchpvs("DB::dbline", GV_ADDMULTI, SVt_PVAV); PL_DBsub = gv_HVadd(gv_fetchpvs("DB::sub", GV_ADDMULTI, SVt_PVHV)); |