… | |
… | |
24 | av_push (av, sv_rvweaken (newRV_inc (sv))); \ |
24 | av_push (av, sv_rvweaken (newRV_inc (sv))); \ |
25 | if (rmagical) SvRMAGICAL_off (sv); \ |
25 | if (rmagical) SvRMAGICAL_off (sv); \ |
26 | av_push (about, newRV_noinc ((SV *)av)); \ |
26 | av_push (about, newRV_noinc ((SV *)av)); \ |
27 | } while (0) |
27 | } while (0) |
28 | |
28 | |
29 | #define res_gv(sigil) \ |
29 | #define res_text(text) \ |
30 | do { \ |
30 | do { \ |
31 | AV *av = newAV (); \ |
31 | AV *av = newAV (); \ |
32 | av_push (av, newSVpv (form ("in the global %c%s::%.*s", sigil, \ |
32 | av_push (av, newSVpv (text, 0)); \ |
33 | HvNAME (GvSTASH (sv)), \ |
|
|
34 | GvNAMELEN (sv), GvNAME (sv) ? GvNAME (sv) : "<anonymous>"), \ |
|
|
35 | 0)); \ |
|
|
36 | av_push (about, newRV_noinc ((SV *)av)); \ |
33 | av_push (about, newRV_noinc ((SV *)av)); \ |
37 | } while (0) |
34 | } while (0) |
|
|
35 | |
|
|
36 | #define res_gv(sigil) \ |
|
|
37 | res_text (form ("in the global %c%s::%.*s", sigil, \ |
|
|
38 | HvNAME (GvSTASH (sv)), \ |
|
|
39 | GvNAMELEN (sv), \ |
|
|
40 | GvNAME (sv) ? GvNAME (sv) : "<anonymous>")) |
38 | |
41 | |
39 | MODULE = Devel::FindRef PACKAGE = Devel::FindRef |
42 | MODULE = Devel::FindRef PACKAGE = Devel::FindRef |
40 | |
43 | |
41 | PROTOTYPES: ENABLE |
44 | PROTOTYPES: ENABLE |
42 | |
45 | |
… | |
… | |
79 | if ((rmagical = SvRMAGICAL (sv))) |
82 | if ((rmagical = SvRMAGICAL (sv))) |
80 | SvRMAGICAL_off (sv); |
83 | SvRMAGICAL_off (sv); |
81 | |
84 | |
82 | if (SvTYPE (sv) >= SVt_PVMG) |
85 | if (SvTYPE (sv) >= SVt_PVMG) |
83 | { |
86 | { |
84 | |
|
|
85 | if (SvTYPE (sv) == SVt_PVMG && SvPAD_OUR (sv)) |
87 | if (SvTYPE (sv) == SVt_PVMG && SvPAD_OUR (sv)) |
86 | { |
88 | { |
87 | /* I have no clue what this is */ |
89 | /* I have no clue what this is */ |
88 | /* maybe some placeholder for our variables for eval? */ |
90 | /* maybe some placeholder for our variables for eval? */ |
89 | /* it doesn'T seem to reference anything, so we should be able to ignore it */ |
91 | /* it doesn't seem to reference anything, so we should be able to ignore it */ |
90 | } |
92 | } |
91 | else |
93 | else |
92 | { |
94 | { |
93 | MAGIC *mg = SvMAGIC (sv); |
95 | MAGIC *mg = SvMAGIC (sv); |
94 | |
96 | |
… | |
… | |
136 | case SVt_PVCV: |
138 | case SVt_PVCV: |
137 | { |
139 | { |
138 | int depth = CvDEPTH (sv); |
140 | int depth = CvDEPTH (sv); |
139 | |
141 | |
140 | /* Anonymous subs have a padlist but zero depth */ |
142 | /* Anonymous subs have a padlist but zero depth */ |
141 | if (!depth && CvPADLIST (sv)) |
143 | if (CvANON (sv) && !depth && CvPADLIST (sv)) |
142 | depth = 1; |
144 | depth = 1; |
143 | |
145 | |
144 | if (depth) |
146 | if (depth) |
145 | { |
147 | { |
146 | AV *padlist = CvPADLIST (sv); |
148 | AV *padlist = CvPADLIST (sv); |
… | |
… | |
170 | if (CvCONST (sv) && (SV*)CvXSUBANY (sv).any_ptr == targ) |
172 | if (CvCONST (sv) && (SV*)CvXSUBANY (sv).any_ptr == targ) |
171 | res_pair ("the constant value of"); |
173 | res_pair ("the constant value of"); |
172 | |
174 | |
173 | if (!CvWEAKOUTSIDE (sv) && (SV*)CvOUTSIDE (sv) == targ) |
175 | if (!CvWEAKOUTSIDE (sv) && (SV*)CvOUTSIDE (sv) == targ) |
174 | res_pair ("the containing scope for"); |
176 | res_pair ("the containing scope for"); |
|
|
177 | |
|
|
178 | if (sv == targ && CvANON (sv)) |
|
|
179 | if (CvSTART (sv) |
|
|
180 | && CvSTART (sv)->op_type == OP_NEXTSTATE |
|
|
181 | && CopLINE ((COP *)CvSTART (sv))) |
|
|
182 | res_text (form ("the closure created at %s:%d", |
|
|
183 | CopFILE ((COP *)CvSTART (sv)) ? CopFILE ((COP *)CvSTART (sv)) : "<unknown>", |
|
|
184 | CopLINE ((COP *)CvSTART (sv)))); |
|
|
185 | else |
|
|
186 | res_text (form ("the closure created somewhere in file %s (PLEASE REPORT!)", |
|
|
187 | CvFILE (sv) ? CvFILE (sv) : "<unknown>")); |
175 | } |
188 | } |
176 | |
189 | |
177 | break; |
190 | break; |
178 | |
191 | |
179 | case SVt_PVGV: |
192 | case SVt_PVGV: |