| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "PERLDEBGUTS 1" |
| 58 |
.TH PERLDEBGUTS 1 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide" |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
perldebguts \- Guts of Perl debugging |
| 65 |
.SH DESCRIPTION |
| 66 |
.IX Header "DESCRIPTION" |
| 67 |
This is not perldebug, which tells you how to use |
| 68 |
the debugger. This manpage describes low-level details concerning |
| 69 |
the debugger's internals, which range from difficult to impossible |
| 70 |
to understand for anyone who isn't incredibly intimate with Perl's guts. |
| 71 |
Caveat lector. |
| 72 |
.SH "Debugger Internals" |
| 73 |
.IX Header "Debugger Internals" |
| 74 |
Perl has special debugging hooks at compile-time and run-time used |
| 75 |
to create debugging environments. These hooks are not to be confused |
| 76 |
with the \fIperl \-Dxxx\fR command described in perlrun, |
| 77 |
which is usable only if a special Perl is built per the instructions in |
| 78 |
the \fIINSTALL\fR file in the Perl source tree. |
| 79 |
.PP |
| 80 |
For example, whenever you call Perl's built-in \f(CW\*(C`caller\*(C'\fR function |
| 81 |
from the package \f(CW\*(C`DB\*(C'\fR, the arguments that the corresponding stack |
| 82 |
frame was called with are copied to the \f(CW@DB::args\fR array. These |
| 83 |
mechanisms are enabled by calling Perl with the \fB\-d\fR switch. |
| 84 |
Specifically, the following additional features are enabled |
| 85 |
(cf. "$^P" in perlvar): |
| 86 |
.IP \(bu 4 |
| 87 |
Perl inserts the contents of \f(CW$ENV{PERL5DB}\fR (or \f(CW\*(C`BEGIN {require |
| 88 |
\&\*(Aqperl5db.pl\*(Aq}\*(C'\fR if not present) before the first line of your program. |
| 89 |
.IP \(bu 4 |
| 90 |
Each array \f(CW\*(C`@{"_<$filename"}\*(C'\fR holds the lines of \f(CW$filename\fR for a |
| 91 |
file compiled by Perl. The same is also true for \f(CW\*(C`eval\*(C'\fRed strings |
| 92 |
that contain subroutines, or which are currently being executed. |
| 93 |
The \f(CW$filename\fR for \f(CW\*(C`eval\*(C'\fRed strings looks like \f(CW\*(C`(eval 34)\*(C'\fR. |
| 94 |
.Sp |
| 95 |
Values in this array are magical in numeric context: they compare |
| 96 |
equal to zero only if the line is not breakable. |
| 97 |
.IP \(bu 4 |
| 98 |
Each hash \f(CW\*(C`%{"_<$filename"}\*(C'\fR contains breakpoints and actions keyed |
| 99 |
by line number. Individual entries (as opposed to the whole hash) |
| 100 |
are settable. Perl only cares about Boolean true here, although |
| 101 |
the values used by \fIperl5db.pl\fR have the form |
| 102 |
\&\f(CW"$break_condition\e0$action"\fR. |
| 103 |
.Sp |
| 104 |
The same holds for evaluated strings that contain subroutines, or |
| 105 |
which are currently being executed. The \f(CW$filename\fR for \f(CW\*(C`eval\*(C'\fRed strings |
| 106 |
looks like \f(CW\*(C`(eval 34)\*(C'\fR. |
| 107 |
.IP \(bu 4 |
| 108 |
Each scalar \f(CW\*(C`${"_<$filename"}\*(C'\fR contains \f(CW$filename\fR. This is |
| 109 |
also the case for evaluated strings that contain subroutines, or |
| 110 |
which are currently being executed. The \f(CW$filename\fR for \f(CW\*(C`eval\*(C'\fRed |
| 111 |
strings looks like \f(CW\*(C`(eval 34)\*(C'\fR. |
| 112 |
.IP \(bu 4 |
| 113 |
After each \f(CW\*(C`require\*(C'\fRd file is compiled, but before it is executed, |
| 114 |
\&\f(CWDB::postponed(*{"_<$filename"})\fR is called if the subroutine |
| 115 |
\&\f(CW\*(C`DB::postponed\*(C'\fR exists. Here, the \f(CW$filename\fR is the expanded name of |
| 116 |
the \f(CW\*(C`require\*(C'\fRd file, as found in the values of \f(CW%INC\fR. |
| 117 |
.IP \(bu 4 |
| 118 |
After each subroutine \f(CW\*(C`subname\*(C'\fR is compiled, the existence of |
| 119 |
\&\f(CW$DB::postponed{subname}\fR is checked. If this key exists, |
| 120 |
\&\f(CWDB::postponed(subname)\fR is called if the \f(CW\*(C`DB::postponed\*(C'\fR subroutine |
| 121 |
also exists. |
| 122 |
.IP \(bu 4 |
| 123 |
A hash \f(CW%DB::sub\fR is maintained, whose keys are subroutine names |
| 124 |
and whose values have the form \f(CW\*(C`filename:startline\-endline\*(C'\fR. |
| 125 |
\&\f(CW\*(C`filename\*(C'\fR has the form \f(CW\*(C`(eval 34)\*(C'\fR for subroutines defined inside |
| 126 |
\&\f(CW\*(C`eval\*(C'\fRs. |
| 127 |
.IP \(bu 4 |
| 128 |
When the execution of your program reaches a point that can hold a |
| 129 |
breakpoint, the \f(CWDB::DB()\fR subroutine is called if any of the variables |
| 130 |
\&\f(CW$DB::trace\fR, \f(CW$DB::single\fR, or \f(CW$DB::signal\fR is true. These variables |
| 131 |
are not \f(CW\*(C`local\*(C'\fRizable. This feature is disabled when executing |
| 132 |
inside \f(CWDB::DB()\fR, including functions called from it |
| 133 |
unless \f(CW\*(C`$^D & (1<<30)\*(C'\fR is true. |
| 134 |
.IP \(bu 4 |
| 135 |
When execution of the program reaches a subroutine call, a call to |
| 136 |
\&\f(CW&DB::sub\fR(\fIargs\fR) is made instead, with \f(CW$DB::sub\fR set to identify |
| 137 |
the called subroutine. (This doesn't happen if the calling subroutine |
| 138 |
was compiled in the \f(CW\*(C`DB\*(C'\fR package.) \f(CW$DB::sub\fR normally holds the name |
| 139 |
of the called subroutine, if it has a name by which it can be looked up. |
| 140 |
Failing that, \f(CW$DB::sub\fR will hold a reference to the called subroutine. |
| 141 |
Either way, the \f(CW&DB::sub\fR subroutine can use \f(CW$DB::sub\fR as a reference |
| 142 |
by which to call the called subroutine, which it will normally want to do. |
| 143 |
.Sp |
| 144 |
If the call is to an lvalue subroutine, and \f(CW&DB::lsub\fR |
| 145 |
is defined \f(CW&DB::lsub\fR(\fIargs\fR) is called instead, otherwise falling |
| 146 |
back to \f(CW&DB::sub\fR(\fIargs\fR). |
| 147 |
.IX Xref "&DB::lsub" |
| 148 |
.IP \(bu 4 |
| 149 |
When execution of the program uses \f(CW\*(C`goto\*(C'\fR to enter a non-XS subroutine |
| 150 |
and the 0x80 bit is set in \f(CW$^P\fR, a call to \f(CW&DB::goto\fR is made, with |
| 151 |
\&\f(CW$DB::sub\fR set to identify the subroutine being entered. The call to |
| 152 |
\&\f(CW&DB::goto\fR does not replace the \f(CW\*(C`goto\*(C'\fR; the requested subroutine will |
| 153 |
still be entered once \f(CW&DB::goto\fR has returned. \f(CW$DB::sub\fR normally |
| 154 |
holds the name of the subroutine being entered, if it has one. Failing |
| 155 |
that, \f(CW$DB::sub\fR will hold a reference to the subroutine being entered. |
| 156 |
Unlike when \f(CW&DB::sub\fR is called, it is not guaranteed that \f(CW$DB::sub\fR |
| 157 |
can be used as a reference to operate on the subroutine being entered. |
| 158 |
.PP |
| 159 |
Note that if \f(CW&DB::sub\fR needs external data for it to work, no |
| 160 |
subroutine call is possible without it. As an example, the standard |
| 161 |
debugger's \f(CW&DB::sub\fR depends on the \f(CW$DB::deep\fR variable |
| 162 |
(it defines how many levels of recursion deep into the debugger you can go |
| 163 |
before a mandatory break). If \f(CW$DB::deep\fR is not defined, subroutine |
| 164 |
calls are not possible, even though \f(CW&DB::sub\fR exists. |
| 165 |
.SS "Writing Your Own Debugger" |
| 166 |
.IX Subsection "Writing Your Own Debugger" |
| 167 |
\fIEnvironment Variables\fR |
| 168 |
.IX Subsection "Environment Variables" |
| 169 |
.PP |
| 170 |
The \f(CW\*(C`PERL5DB\*(C'\fR environment variable can be used to define a debugger. |
| 171 |
For example, the minimal "working" debugger (it actually doesn't do anything) |
| 172 |
consists of one line: |
| 173 |
.PP |
| 174 |
.Vb 1 |
| 175 |
\& sub DB::DB {} |
| 176 |
.Ve |
| 177 |
.PP |
| 178 |
It can easily be defined like this: |
| 179 |
.PP |
| 180 |
.Vb 1 |
| 181 |
\& $ PERL5DB="sub DB::DB {}" perl \-d your\-script |
| 182 |
.Ve |
| 183 |
.PP |
| 184 |
Another brief debugger, slightly more useful, can be created |
| 185 |
with only the line: |
| 186 |
.PP |
| 187 |
.Vb 1 |
| 188 |
\& sub DB::DB {print ++$i; scalar <STDIN>} |
| 189 |
.Ve |
| 190 |
.PP |
| 191 |
This debugger prints a number which increments for each statement |
| 192 |
encountered and waits for you to hit a newline before continuing |
| 193 |
to the next statement. |
| 194 |
.PP |
| 195 |
The following debugger is actually useful: |
| 196 |
.PP |
| 197 |
.Vb 5 |
| 198 |
\& { |
| 199 |
\& package DB; |
| 200 |
\& sub DB {} |
| 201 |
\& sub sub {print ++$i, " $sub\en"; &$sub} |
| 202 |
\& } |
| 203 |
.Ve |
| 204 |
.PP |
| 205 |
It prints the sequence number of each subroutine call and the name of the |
| 206 |
called subroutine. Note that \f(CW&DB::sub\fR is being compiled into the |
| 207 |
package \f(CW\*(C`DB\*(C'\fR through the use of the \f(CW\*(C`package\*(C'\fR directive. |
| 208 |
.PP |
| 209 |
When it starts, the debugger reads your rc file (\fI./.perldb\fR or |
| 210 |
\&\fI~/.perldb\fR under Unix), which can set important options. |
| 211 |
(A subroutine (\f(CW&afterinit\fR) can be defined here as well; it is executed |
| 212 |
after the debugger completes its own initialization.) |
| 213 |
.PP |
| 214 |
After the rc file is read, the debugger reads the PERLDB_OPTS |
| 215 |
environment variable and uses it to set debugger options. The |
| 216 |
contents of this variable are treated as if they were the argument |
| 217 |
of an \f(CW\*(C`o ...\*(C'\fR debugger command (q.v. in "Configurable Options" in perldebug). |
| 218 |
.PP |
| 219 |
\fIDebugger Internal Variables\fR |
| 220 |
.IX Subsection "Debugger Internal Variables" |
| 221 |
.PP |
| 222 |
In addition to the file and subroutine-related variables mentioned above, |
| 223 |
the debugger also maintains various magical internal variables. |
| 224 |
.IP \(bu 4 |
| 225 |
\&\f(CW@DB::dbline\fR is an alias for \f(CW\*(C`@{"::_<current_file"}\*(C'\fR, which |
| 226 |
holds the lines of the currently-selected file (compiled by Perl), either |
| 227 |
explicitly chosen with the debugger's \f(CW\*(C`f\*(C'\fR command, or implicitly by flow |
| 228 |
of execution. |
| 229 |
.Sp |
| 230 |
Values in this array are magical in numeric context: they compare |
| 231 |
equal to zero only if the line is not breakable. |
| 232 |
.IP \(bu 4 |
| 233 |
\&\f(CW%DB::dbline\fR is an alias for \f(CW\*(C`%{"::_<current_file"}\*(C'\fR, which |
| 234 |
contains breakpoints and actions keyed by line number in |
| 235 |
the currently-selected file, either explicitly chosen with the |
| 236 |
debugger's \f(CW\*(C`f\*(C'\fR command, or implicitly by flow of execution. |
| 237 |
.Sp |
| 238 |
As previously noted, individual entries (as opposed to the whole hash) |
| 239 |
are settable. Perl only cares about Boolean true here, although |
| 240 |
the values used by \fIperl5db.pl\fR have the form |
| 241 |
\&\f(CW"$break_condition\e0$action"\fR. |
| 242 |
.PP |
| 243 |
\fIDebugger Customization Functions\fR |
| 244 |
.IX Subsection "Debugger Customization Functions" |
| 245 |
.PP |
| 246 |
Some functions are provided to simplify customization. |
| 247 |
.IP \(bu 4 |
| 248 |
See "Configurable Options" in perldebug for a description of options parsed by |
| 249 |
\&\f(CWDB::parse_options(string)\fR. |
| 250 |
.IP \(bu 4 |
| 251 |
\&\f(CW\*(C`DB::dump_trace(skip[,count])\*(C'\fR skips the specified number of frames |
| 252 |
and returns a list containing information about the calling frames (all |
| 253 |
of them, if \f(CW\*(C`count\*(C'\fR is missing). Each entry is reference to a hash |
| 254 |
with keys \f(CW\*(C`context\*(C'\fR (either \f(CW\*(C`.\*(C'\fR, \f(CW\*(C`$\*(C'\fR, or \f(CW\*(C`@\*(C'\fR), \f(CW\*(C`sub\*(C'\fR (subroutine |
| 255 |
name, or info about \f(CW\*(C`eval\*(C'\fR), \f(CW\*(C`args\*(C'\fR (\f(CW\*(C`undef\*(C'\fR or a reference to |
| 256 |
an array), \f(CW\*(C`file\*(C'\fR, and \f(CW\*(C`line\*(C'\fR. |
| 257 |
.IP \(bu 4 |
| 258 |
\&\f(CW\*(C`DB::print_trace(FH, skip[, count[, short]])\*(C'\fR prints |
| 259 |
formatted info about caller frames. The last two functions may be |
| 260 |
convenient as arguments to \f(CW\*(C`<\*(C'\fR, \f(CW\*(C`<<\*(C'\fR commands. |
| 261 |
.PP |
| 262 |
Note that any variables and functions that are not documented in |
| 263 |
this manpages (or in perldebug) are considered for internal |
| 264 |
use only, and as such are subject to change without notice. |
| 265 |
.SH "Frame Listing Output Examples" |
| 266 |
.IX Header "Frame Listing Output Examples" |
| 267 |
The \f(CW\*(C`frame\*(C'\fR option can be used to control the output of frame |
| 268 |
information. For example, contrast this expression trace: |
| 269 |
.PP |
| 270 |
.Vb 2 |
| 271 |
\& $ perl \-de 42 |
| 272 |
\& Stack dump during die enabled outside of evals. |
| 273 |
\& |
| 274 |
\& Loading DB routines from perl5db.pl patch level 0.94 |
| 275 |
\& Emacs support available. |
| 276 |
\& |
| 277 |
\& Enter h or \*(Aqh h\*(Aq for help. |
| 278 |
\& |
| 279 |
\& main::(\-e:1): 0 |
| 280 |
\& DB<1> sub foo { 14 } |
| 281 |
\& |
| 282 |
\& DB<2> sub bar { 3 } |
| 283 |
\& |
| 284 |
\& DB<3> t print foo() * bar() |
| 285 |
\& main::((eval 172):3): print foo() + bar(); |
| 286 |
\& main::foo((eval 168):2): |
| 287 |
\& main::bar((eval 170):2): |
| 288 |
\& 42 |
| 289 |
.Ve |
| 290 |
.PP |
| 291 |
with this one, once the \f(CW\*(C`o\*(C'\fRption \f(CW\*(C`frame=2\*(C'\fR has been set: |
| 292 |
.PP |
| 293 |
.Vb 11 |
| 294 |
\& DB<4> o f=2 |
| 295 |
\& frame = \*(Aq2\*(Aq |
| 296 |
\& DB<5> t print foo() * bar() |
| 297 |
\& 3: foo() * bar() |
| 298 |
\& entering main::foo |
| 299 |
\& 2: sub foo { 14 }; |
| 300 |
\& exited main::foo |
| 301 |
\& entering main::bar |
| 302 |
\& 2: sub bar { 3 }; |
| 303 |
\& exited main::bar |
| 304 |
\& 42 |
| 305 |
.Ve |
| 306 |
.PP |
| 307 |
By way of demonstration, we present below a laborious listing |
| 308 |
resulting from setting your \f(CW\*(C`PERLDB_OPTS\*(C'\fR environment variable to |
| 309 |
the value \f(CW\*(C`f=n N\*(C'\fR, and running \fIperl \-d \-V\fR from the command line. |
| 310 |
Examples using various values of \f(CW\*(C`n\*(C'\fR are shown to give you a feel |
| 311 |
for the difference between settings. Long though it may be, this |
| 312 |
is not a complete listing, but only excerpts. |
| 313 |
.IP 1. 4 |
| 314 |
.Vb 10 |
| 315 |
\& entering main::BEGIN |
| 316 |
\& entering Config::BEGIN |
| 317 |
\& Package lib/Exporter.pm. |
| 318 |
\& Package lib/Carp.pm. |
| 319 |
\& Package lib/Config.pm. |
| 320 |
\& entering Config::TIEHASH |
| 321 |
\& entering Exporter::import |
| 322 |
\& entering Exporter::export |
| 323 |
\& entering Config::myconfig |
| 324 |
\& entering Config::FETCH |
| 325 |
\& entering Config::FETCH |
| 326 |
\& entering Config::FETCH |
| 327 |
\& entering Config::FETCH |
| 328 |
.Ve |
| 329 |
.IP 2. 4 |
| 330 |
.Vb 10 |
| 331 |
\& entering main::BEGIN |
| 332 |
\& entering Config::BEGIN |
| 333 |
\& Package lib/Exporter.pm. |
| 334 |
\& Package lib/Carp.pm. |
| 335 |
\& exited Config::BEGIN |
| 336 |
\& Package lib/Config.pm. |
| 337 |
\& entering Config::TIEHASH |
| 338 |
\& exited Config::TIEHASH |
| 339 |
\& entering Exporter::import |
| 340 |
\& entering Exporter::export |
| 341 |
\& exited Exporter::export |
| 342 |
\& exited Exporter::import |
| 343 |
\& exited main::BEGIN |
| 344 |
\& entering Config::myconfig |
| 345 |
\& entering Config::FETCH |
| 346 |
\& exited Config::FETCH |
| 347 |
\& entering Config::FETCH |
| 348 |
\& exited Config::FETCH |
| 349 |
\& entering Config::FETCH |
| 350 |
.Ve |
| 351 |
.IP 3. 4 |
| 352 |
.Vb 10 |
| 353 |
\& in $=main::BEGIN() from /dev/null:0 |
| 354 |
\& in $=Config::BEGIN() from lib/Config.pm:2 |
| 355 |
\& Package lib/Exporter.pm. |
| 356 |
\& Package lib/Carp.pm. |
| 357 |
\& Package lib/Config.pm. |
| 358 |
\& in $=Config::TIEHASH(\*(AqConfig\*(Aq) from lib/Config.pm:644 |
| 359 |
\& in $=Exporter::import(\*(AqConfig\*(Aq, \*(Aqmyconfig\*(Aq, \*(Aqconfig_vars\*(Aq) from /dev/null:0 |
| 360 |
\& in $=Exporter::export(\*(AqConfig\*(Aq, \*(Aqmain\*(Aq, \*(Aqmyconfig\*(Aq, \*(Aqconfig_vars\*(Aq) from li |
| 361 |
\& in @=Config::myconfig() from /dev/null:0 |
| 362 |
\& in $=Config::FETCH(ref(Config), \*(Aqpackage\*(Aq) from lib/Config.pm:574 |
| 363 |
\& in $=Config::FETCH(ref(Config), \*(Aqbaserev\*(Aq) from lib/Config.pm:574 |
| 364 |
\& in $=Config::FETCH(ref(Config), \*(AqPERL_VERSION\*(Aq) from lib/Config.pm:574 |
| 365 |
\& in $=Config::FETCH(ref(Config), \*(AqPERL_SUBVERSION\*(Aq) from lib/Config.pm:574 |
| 366 |
\& in $=Config::FETCH(ref(Config), \*(Aqosname\*(Aq) from lib/Config.pm:574 |
| 367 |
\& in $=Config::FETCH(ref(Config), \*(Aqosvers\*(Aq) from lib/Config.pm:574 |
| 368 |
.Ve |
| 369 |
.IP 4. 4 |
| 370 |
.Vb 10 |
| 371 |
\& in $=main::BEGIN() from /dev/null:0 |
| 372 |
\& in $=Config::BEGIN() from lib/Config.pm:2 |
| 373 |
\& Package lib/Exporter.pm. |
| 374 |
\& Package lib/Carp.pm. |
| 375 |
\& out $=Config::BEGIN() from lib/Config.pm:0 |
| 376 |
\& Package lib/Config.pm. |
| 377 |
\& in $=Config::TIEHASH(\*(AqConfig\*(Aq) from lib/Config.pm:644 |
| 378 |
\& out $=Config::TIEHASH(\*(AqConfig\*(Aq) from lib/Config.pm:644 |
| 379 |
\& in $=Exporter::import(\*(AqConfig\*(Aq, \*(Aqmyconfig\*(Aq, \*(Aqconfig_vars\*(Aq) from /dev/null:0 |
| 380 |
\& in $=Exporter::export(\*(AqConfig\*(Aq, \*(Aqmain\*(Aq, \*(Aqmyconfig\*(Aq, \*(Aqconfig_vars\*(Aq) from lib/ |
| 381 |
\& out $=Exporter::export(\*(AqConfig\*(Aq, \*(Aqmain\*(Aq, \*(Aqmyconfig\*(Aq, \*(Aqconfig_vars\*(Aq) from lib/ |
| 382 |
\& out $=Exporter::import(\*(AqConfig\*(Aq, \*(Aqmyconfig\*(Aq, \*(Aqconfig_vars\*(Aq) from /dev/null:0 |
| 383 |
\& out $=main::BEGIN() from /dev/null:0 |
| 384 |
\& in @=Config::myconfig() from /dev/null:0 |
| 385 |
\& in $=Config::FETCH(ref(Config), \*(Aqpackage\*(Aq) from lib/Config.pm:574 |
| 386 |
\& out $=Config::FETCH(ref(Config), \*(Aqpackage\*(Aq) from lib/Config.pm:574 |
| 387 |
\& in $=Config::FETCH(ref(Config), \*(Aqbaserev\*(Aq) from lib/Config.pm:574 |
| 388 |
\& out $=Config::FETCH(ref(Config), \*(Aqbaserev\*(Aq) from lib/Config.pm:574 |
| 389 |
\& in $=Config::FETCH(ref(Config), \*(AqPERL_VERSION\*(Aq) from lib/Config.pm:574 |
| 390 |
\& out $=Config::FETCH(ref(Config), \*(AqPERL_VERSION\*(Aq) from lib/Config.pm:574 |
| 391 |
\& in $=Config::FETCH(ref(Config), \*(AqPERL_SUBVERSION\*(Aq) from lib/Config.pm:574 |
| 392 |
.Ve |
| 393 |
.IP 5. 4 |
| 394 |
.Vb 10 |
| 395 |
\& in $=main::BEGIN() from /dev/null:0 |
| 396 |
\& in $=Config::BEGIN() from lib/Config.pm:2 |
| 397 |
\& Package lib/Exporter.pm. |
| 398 |
\& Package lib/Carp.pm. |
| 399 |
\& out $=Config::BEGIN() from lib/Config.pm:0 |
| 400 |
\& Package lib/Config.pm. |
| 401 |
\& in $=Config::TIEHASH(\*(AqConfig\*(Aq) from lib/Config.pm:644 |
| 402 |
\& out $=Config::TIEHASH(\*(AqConfig\*(Aq) from lib/Config.pm:644 |
| 403 |
\& in $=Exporter::import(\*(AqConfig\*(Aq, \*(Aqmyconfig\*(Aq, \*(Aqconfig_vars\*(Aq) from /dev/null:0 |
| 404 |
\& in $=Exporter::export(\*(AqConfig\*(Aq, \*(Aqmain\*(Aq, \*(Aqmyconfig\*(Aq, \*(Aqconfig_vars\*(Aq) from lib/E |
| 405 |
\& out $=Exporter::export(\*(AqConfig\*(Aq, \*(Aqmain\*(Aq, \*(Aqmyconfig\*(Aq, \*(Aqconfig_vars\*(Aq) from lib/E |
| 406 |
\& out $=Exporter::import(\*(AqConfig\*(Aq, \*(Aqmyconfig\*(Aq, \*(Aqconfig_vars\*(Aq) from /dev/null:0 |
| 407 |
\& out $=main::BEGIN() from /dev/null:0 |
| 408 |
\& in @=Config::myconfig() from /dev/null:0 |
| 409 |
\& in $=Config::FETCH(\*(AqConfig=HASH(0x1aa444)\*(Aq, \*(Aqpackage\*(Aq) from lib/Config.pm:574 |
| 410 |
\& out $=Config::FETCH(\*(AqConfig=HASH(0x1aa444)\*(Aq, \*(Aqpackage\*(Aq) from lib/Config.pm:574 |
| 411 |
\& in $=Config::FETCH(\*(AqConfig=HASH(0x1aa444)\*(Aq, \*(Aqbaserev\*(Aq) from lib/Config.pm:574 |
| 412 |
\& out $=Config::FETCH(\*(AqConfig=HASH(0x1aa444)\*(Aq, \*(Aqbaserev\*(Aq) from lib/Config.pm:574 |
| 413 |
.Ve |
| 414 |
.IP 6. 4 |
| 415 |
.Vb 10 |
| 416 |
\& in $=CODE(0x15eca4)() from /dev/null:0 |
| 417 |
\& in $=CODE(0x182528)() from lib/Config.pm:2 |
| 418 |
\& Package lib/Exporter.pm. |
| 419 |
\& out $=CODE(0x182528)() from lib/Config.pm:0 |
| 420 |
\& scalar context return from CODE(0x182528): undef |
| 421 |
\& Package lib/Config.pm. |
| 422 |
\& in $=Config::TIEHASH(\*(AqConfig\*(Aq) from lib/Config.pm:628 |
| 423 |
\& out $=Config::TIEHASH(\*(AqConfig\*(Aq) from lib/Config.pm:628 |
| 424 |
\& scalar context return from Config::TIEHASH: empty hash |
| 425 |
\& in $=Exporter::import(\*(AqConfig\*(Aq, \*(Aqmyconfig\*(Aq, \*(Aqconfig_vars\*(Aq) from /dev/null:0 |
| 426 |
\& in $=Exporter::export(\*(AqConfig\*(Aq, \*(Aqmain\*(Aq, \*(Aqmyconfig\*(Aq, \*(Aqconfig_vars\*(Aq) from lib/Exporter.pm:171 |
| 427 |
\& out $=Exporter::export(\*(AqConfig\*(Aq, \*(Aqmain\*(Aq, \*(Aqmyconfig\*(Aq, \*(Aqconfig_vars\*(Aq) from lib/Exporter.pm:171 |
| 428 |
\& scalar context return from Exporter::export: \*(Aq\*(Aq |
| 429 |
\& out $=Exporter::import(\*(AqConfig\*(Aq, \*(Aqmyconfig\*(Aq, \*(Aqconfig_vars\*(Aq) from /dev/null:0 |
| 430 |
\& scalar context return from Exporter::import: \*(Aq\*(Aq |
| 431 |
.Ve |
| 432 |
.PP |
| 433 |
In all cases shown above, the line indentation shows the call tree. |
| 434 |
If bit 2 of \f(CW\*(C`frame\*(C'\fR is set, a line is printed on exit from a |
| 435 |
subroutine as well. If bit 4 is set, the arguments are printed |
| 436 |
along with the caller info. If bit 8 is set, the arguments are |
| 437 |
printed even if they are tied or references. If bit 16 is set, the |
| 438 |
return value is printed, too. |
| 439 |
.PP |
| 440 |
When a package is compiled, a line like this |
| 441 |
.PP |
| 442 |
.Vb 1 |
| 443 |
\& Package lib/Carp.pm. |
| 444 |
.Ve |
| 445 |
.PP |
| 446 |
is printed with proper indentation. |
| 447 |
.SH "Debugging Regular Expressions" |
| 448 |
.IX Header "Debugging Regular Expressions" |
| 449 |
There are two ways to enable debugging output for regular expressions. |
| 450 |
.PP |
| 451 |
If your perl is compiled with \f(CW\*(C`\-DDEBUGGING\*(C'\fR, you may use the |
| 452 |
\&\fB\-Dr\fR flag on the command line, and \f(CW\*(C`\-Drv\*(C'\fR for more verbose |
| 453 |
information. |
| 454 |
.PP |
| 455 |
Otherwise, one can \f(CW\*(C`use re \*(Aqdebug\*(Aq\*(C'\fR, which has effects at both |
| 456 |
compile time and run time. Since Perl 5.9.5, this pragma is lexically |
| 457 |
scoped. |
| 458 |
.SS "Compile-time Output" |
| 459 |
.IX Subsection "Compile-time Output" |
| 460 |
The debugging output at compile time looks like this: |
| 461 |
.PP |
| 462 |
.Vb 10 |
| 463 |
\& Compiling REx \*(Aq[bc]d(ef*g)+h[ij]k$\*(Aq |
| 464 |
\& size 45 Got 364 bytes for offset annotations. |
| 465 |
\& first at 1 |
| 466 |
\& rarest char g at 0 |
| 467 |
\& rarest char d at 0 |
| 468 |
\& 1: ANYOF[bc](12) |
| 469 |
\& 12: EXACT <d>(14) |
| 470 |
\& 14: CURLYX[0] {1,32767}(28) |
| 471 |
\& 16: OPEN1(18) |
| 472 |
\& 18: EXACT <e>(20) |
| 473 |
\& 20: STAR(23) |
| 474 |
\& 21: EXACT <f>(0) |
| 475 |
\& 23: EXACT <g>(25) |
| 476 |
\& 25: CLOSE1(27) |
| 477 |
\& 27: WHILEM[1/1](0) |
| 478 |
\& 28: NOTHING(29) |
| 479 |
\& 29: EXACT <h>(31) |
| 480 |
\& 31: ANYOF[ij](42) |
| 481 |
\& 42: EXACT <k>(44) |
| 482 |
\& 44: EOL(45) |
| 483 |
\& 45: END(0) |
| 484 |
\& anchored \*(Aqde\*(Aq at 1 floating \*(Aqgh\*(Aq at 3..2147483647 (checking floating) |
| 485 |
\& stclass \*(AqANYOF[bc]\*(Aq minlen 7 |
| 486 |
\& Offsets: [45] |
| 487 |
\& 1[4] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 5[1] |
| 488 |
\& 0[0] 12[1] 0[0] 6[1] 0[0] 7[1] 0[0] 9[1] 8[1] 0[0] 10[1] 0[0] |
| 489 |
\& 11[1] 0[0] 12[0] 12[0] 13[1] 0[0] 14[4] 0[0] 0[0] 0[0] 0[0] |
| 490 |
\& 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 18[1] 0[0] 19[1] 20[0] |
| 491 |
\& Omitting $\` $& $\*(Aq support. |
| 492 |
.Ve |
| 493 |
.PP |
| 494 |
The first line shows the pre-compiled form of the regex. The second |
| 495 |
shows the size of the compiled form (in arbitrary units, usually |
| 496 |
4\-byte words) and the total number of bytes allocated for the |
| 497 |
offset/length table, usually 4+\f(CW\*(C`size\*(C'\fR*8. The next line shows the |
| 498 |
label \fIid\fR of the first node that does a match. |
| 499 |
.PP |
| 500 |
The |
| 501 |
.PP |
| 502 |
.Vb 2 |
| 503 |
\& anchored \*(Aqde\*(Aq at 1 floating \*(Aqgh\*(Aq at 3..2147483647 (checking floating) |
| 504 |
\& stclass \*(AqANYOF[bc]\*(Aq minlen 7 |
| 505 |
.Ve |
| 506 |
.PP |
| 507 |
line (split into two lines above) contains optimizer |
| 508 |
information. In the example shown, the optimizer found that the match |
| 509 |
should contain a substring \f(CW\*(C`de\*(C'\fR at offset 1, plus substring \f(CW\*(C`gh\*(C'\fR |
| 510 |
at some offset between 3 and infinity. Moreover, when checking for |
| 511 |
these substrings (to abandon impossible matches quickly), Perl will check |
| 512 |
for the substring \f(CW\*(C`gh\*(C'\fR before checking for the substring \f(CW\*(C`de\*(C'\fR. The |
| 513 |
optimizer may also use the knowledge that the match starts (at the |
| 514 |
\&\f(CW\*(C`first\*(C'\fR \fIid\fR) with a character class, and no string |
| 515 |
shorter than 7 characters can possibly match. |
| 516 |
.PP |
| 517 |
The fields of interest which may appear in this line are |
| 518 |
.ie n .IP """anchored"" \fISTRING\fR ""at"" \fIPOS\fR" 4 |
| 519 |
.el .IP "\f(CWanchored\fR \fISTRING\fR \f(CWat\fR \fIPOS\fR" 4 |
| 520 |
.IX Item "anchored STRING at POS" |
| 521 |
.PD 0 |
| 522 |
.ie n .IP """floating"" \fISTRING\fR ""at"" \fIPOS1..POS2\fR" 4 |
| 523 |
.el .IP "\f(CWfloating\fR \fISTRING\fR \f(CWat\fR \fIPOS1..POS2\fR" 4 |
| 524 |
.IX Item "floating STRING at POS1..POS2" |
| 525 |
.PD |
| 526 |
See above. |
| 527 |
.ie n .IP """matching floating/anchored""" 4 |
| 528 |
.el .IP "\f(CWmatching floating/anchored\fR" 4 |
| 529 |
.IX Item "matching floating/anchored" |
| 530 |
Which substring to check first. |
| 531 |
.ie n .IP """minlen""" 4 |
| 532 |
.el .IP \f(CWminlen\fR 4 |
| 533 |
.IX Item "minlen" |
| 534 |
The minimal length of the match. |
| 535 |
.ie n .IP """stclass"" \fITYPE\fR" 4 |
| 536 |
.el .IP "\f(CWstclass\fR \fITYPE\fR" 4 |
| 537 |
.IX Item "stclass TYPE" |
| 538 |
Type of first matching node. |
| 539 |
.ie n .IP """noscan""" 4 |
| 540 |
.el .IP \f(CWnoscan\fR 4 |
| 541 |
.IX Item "noscan" |
| 542 |
Don't scan for the found substrings. |
| 543 |
.ie n .IP """isall""" 4 |
| 544 |
.el .IP \f(CWisall\fR 4 |
| 545 |
.IX Item "isall" |
| 546 |
Means that the optimizer information is all that the regular |
| 547 |
expression contains, and thus one does not need to enter the regex engine at |
| 548 |
all. |
| 549 |
.ie n .IP """GPOS""" 4 |
| 550 |
.el .IP \f(CWGPOS\fR 4 |
| 551 |
.IX Item "GPOS" |
| 552 |
Set if the pattern contains \f(CW\*(C`\eG\*(C'\fR. |
| 553 |
.ie n .IP """plus""" 4 |
| 554 |
.el .IP \f(CWplus\fR 4 |
| 555 |
.IX Item "plus" |
| 556 |
Set if the pattern starts with a repeated char (as in \f(CW\*(C`x+y\*(C'\fR). |
| 557 |
.ie n .IP """implicit""" 4 |
| 558 |
.el .IP \f(CWimplicit\fR 4 |
| 559 |
.IX Item "implicit" |
| 560 |
Set if the pattern starts with \f(CW\*(C`.*\*(C'\fR. |
| 561 |
.ie n .IP """with eval""" 4 |
| 562 |
.el .IP "\f(CWwith eval\fR" 4 |
| 563 |
.IX Item "with eval" |
| 564 |
Set if the pattern contain eval-groups, such as \f(CW\*(C`(?{ code })\*(C'\fR and |
| 565 |
\&\f(CW\*(C`(??{ code })\*(C'\fR. |
| 566 |
.ie n .IP anchored(TYPE) 4 |
| 567 |
.el .IP \f(CWanchored(TYPE)\fR 4 |
| 568 |
.IX Item "anchored(TYPE)" |
| 569 |
If the pattern may match only at a handful of places, with \f(CW\*(C`TYPE\*(C'\fR |
| 570 |
being \f(CW\*(C`SBOL\*(C'\fR, \f(CW\*(C`MBOL\*(C'\fR, or \f(CW\*(C`GPOS\*(C'\fR. See the table below. |
| 571 |
.PP |
| 572 |
If a substring is known to match at end-of-line only, it may be |
| 573 |
followed by \f(CW\*(C`$\*(C'\fR, as in \f(CW\*(C`floating \*(Aqk\*(Aq$\*(C'\fR. |
| 574 |
.PP |
| 575 |
The optimizer-specific information is used to avoid entering (a slow) regex |
| 576 |
engine on strings that will not definitely match. If the \f(CW\*(C`isall\*(C'\fR flag |
| 577 |
is set, a call to the regex engine may be avoided even when the optimizer |
| 578 |
found an appropriate place for the match. |
| 579 |
.PP |
| 580 |
Above the optimizer section is the list of \fInodes\fR of the compiled |
| 581 |
form of the regex. Each line has format |
| 582 |
.PP |
| 583 |
\&\f(CW\*(C` \*(C'\fR\fIid\fR: \fITYPE\fR \fIOPTIONAL-INFO\fR (\fInext-id\fR) |
| 584 |
.SS "Types of Nodes" |
| 585 |
.IX Subsection "Types of Nodes" |
| 586 |
Here are the current possible types, with short descriptions: |
| 587 |
.PP |
| 588 |
.Vb 1 |
| 589 |
\& # TYPE arg\-description [regnode\-struct\-suffix] [longjump\-len] DESCRIPTION |
| 590 |
\& |
| 591 |
\& # Exit points |
| 592 |
\& |
| 593 |
\& END no End of program. |
| 594 |
\& SUCCEED no Return from a subroutine, basically. |
| 595 |
\& |
| 596 |
\& # Line Start Anchors: |
| 597 |
\& SBOL no Match "" at beginning of line: /^/, /\eA/ |
| 598 |
\& MBOL no Same, assuming multiline: /^/m |
| 599 |
\& |
| 600 |
\& # Line End Anchors: |
| 601 |
\& SEOL no Match "" at end of line: /$/ |
| 602 |
\& MEOL no Same, assuming multiline: /$/m |
| 603 |
\& EOS no Match "" at end of string: /\ez/ |
| 604 |
\& |
| 605 |
\& # Match Start Anchors: |
| 606 |
\& GPOS no Matches where last m//g left off. |
| 607 |
\& |
| 608 |
\& # Word Boundary Opcodes: |
| 609 |
\& BOUND no Like BOUNDA for non\-utf8, otherwise like |
| 610 |
\& BOUNDU |
| 611 |
\& BOUNDL no Like BOUND/BOUNDU, but \ew and \eW are |
| 612 |
\& defined by current locale |
| 613 |
\& BOUNDU no Match "" at any boundary of a given type |
| 614 |
\& using /u rules. |
| 615 |
\& BOUNDA no Match "" at any boundary between \ew\eW or |
| 616 |
\& \eW\ew, where \ew is [_a\-zA\-Z0\-9] |
| 617 |
\& NBOUND no Like NBOUNDA for non\-utf8, otherwise like |
| 618 |
\& BOUNDU |
| 619 |
\& NBOUNDL no Like NBOUND/NBOUNDU, but \ew and \eW are |
| 620 |
\& defined by current locale |
| 621 |
\& NBOUNDU no Match "" at any non\-boundary of a given |
| 622 |
\& type using using /u rules. |
| 623 |
\& NBOUNDA no Match "" betweeen any \ew\ew or \eW\eW, where |
| 624 |
\& \ew is [_a\-zA\-Z0\-9] |
| 625 |
\& |
| 626 |
\& # [Special] alternatives: |
| 627 |
\& REG_ANY no Match any one character (except newline). |
| 628 |
\& SANY no Match any one character. |
| 629 |
\& ANYOF sv Match character in (or not in) this class, |
| 630 |
\& charclass single char match only |
| 631 |
\& ANYOFD sv Like ANYOF, but /d is in effect |
| 632 |
\& charclass |
| 633 |
\& ANYOFL sv Like ANYOF, but /l is in effect |
| 634 |
\& charclass |
| 635 |
\& ANYOFPOSIXL sv Like ANYOFL, but matches [[:posix:]] |
| 636 |
\& charclass_ classes |
| 637 |
\& posixl |
| 638 |
\& |
| 639 |
\& ANYOFH sv 1 Like ANYOF, but only has "High" matches, |
| 640 |
\& none in the bitmap; the flags field |
| 641 |
\& contains the lowest matchable UTF\-8 start |
| 642 |
\& byte |
| 643 |
\& ANYOFHb sv 1 Like ANYOFH, but all matches share the same |
| 644 |
\& UTF\-8 start byte, given in the flags field |
| 645 |
\& ANYOFHr sv 1 Like ANYOFH, but the flags field contains |
| 646 |
\& packed bounds for all matchable UTF\-8 start |
| 647 |
\& bytes. |
| 648 |
\& ANYOFHs sv:str 1 Like ANYOFHb, but has a string field that |
| 649 |
\& gives the leading matchable UTF\-8 bytes; |
| 650 |
\& flags field is len |
| 651 |
\& ANYOFR packed 1 Matches any character in the range given by |
| 652 |
\& its packed args: upper 12 bits is the max |
| 653 |
\& delta from the base lower 20; the flags |
| 654 |
\& field contains the lowest matchable UTF\-8 |
| 655 |
\& start byte |
| 656 |
\& ANYOFRb packed 1 Like ANYOFR, but all matches share the same |
| 657 |
\& UTF\-8 start byte, given in the flags field |
| 658 |
\& |
| 659 |
\& ANYOFHbbm none bbm Like ANYOFHb, but only for 2\-byte UTF\-8 |
| 660 |
\& characters; uses a bitmap to match the |
| 661 |
\& continuation byte |
| 662 |
\& |
| 663 |
\& ANYOFM byte 1 Like ANYOF, but matches an invariant byte |
| 664 |
\& as determined by the mask and arg |
| 665 |
\& NANYOFM byte 1 complement of ANYOFM |
| 666 |
\& |
| 667 |
\& # POSIX Character Classes: |
| 668 |
\& POSIXD none Some [[:class:]] under /d; the FLAGS field |
| 669 |
\& gives which one |
| 670 |
\& POSIXL none Some [[:class:]] under /l; the FLAGS field |
| 671 |
\& gives which one |
| 672 |
\& POSIXU none Some [[:class:]] under /u; the FLAGS field |
| 673 |
\& gives which one |
| 674 |
\& POSIXA none Some [[:class:]] under /a; the FLAGS field |
| 675 |
\& gives which one |
| 676 |
\& NPOSIXD none complement of POSIXD, [[:^class:]] |
| 677 |
\& NPOSIXL none complement of POSIXL, [[:^class:]] |
| 678 |
\& NPOSIXU none complement of POSIXU, [[:^class:]] |
| 679 |
\& NPOSIXA none complement of POSIXA, [[:^class:]] |
| 680 |
\& |
| 681 |
\& CLUMP no Match any extended grapheme cluster |
| 682 |
\& sequence |
| 683 |
\& |
| 684 |
\& # Alternation |
| 685 |
\& |
| 686 |
\& # BRANCH The set of branches constituting a single choice are |
| 687 |
\& # hooked together with their "next" pointers, since |
| 688 |
\& # precedence prevents anything being concatenated to |
| 689 |
\& # any individual branch. The "next" pointer of the last |
| 690 |
\& # BRANCH in a choice points to the thing following the |
| 691 |
\& # whole choice. This is also where the final "next" |
| 692 |
\& # pointer of each individual branch points; each branch |
| 693 |
\& # starts with the operand node of a BRANCH node. |
| 694 |
\& # |
| 695 |
\& BRANCH node 1 Match this alternative, or the next... |
| 696 |
\& |
| 697 |
\& # Literals |
| 698 |
\& |
| 699 |
\& EXACT str Match this string (flags field is the |
| 700 |
\& length). |
| 701 |
\& |
| 702 |
\& # In a long string node, the U32 argument is the length, and is |
| 703 |
\& # immediately followed by the string. |
| 704 |
\& LEXACT len:str 1 Match this long string (preceded by length; |
| 705 |
\& flags unused). |
| 706 |
\& EXACTL str Like EXACT, but /l is in effect (used so |
| 707 |
\& locale\-related warnings can be checked for) |
| 708 |
\& EXACTF str Like EXACT, but match using /id rules; |
| 709 |
\& (string not UTF\-8, ASCII folded; non\-ASCII |
| 710 |
\& not) |
| 711 |
\& EXACTFL str Like EXACT, but match using /il rules; |
| 712 |
\& (string not likely to be folded) |
| 713 |
\& EXACTFU str Like EXACT, but match using /iu rules; |
| 714 |
\& (string folded) |
| 715 |
\& |
| 716 |
\& EXACTFAA str Like EXACT, but match using /iaa rules; |
| 717 |
\& (string folded except MICRO in non\-UTF8 |
| 718 |
\& patterns; doesn\*(Aqt contain SHARP S unless |
| 719 |
\& UTF\-8; folded length <= unfolded) |
| 720 |
\& EXACTFAA_NO_TRIE str Like EXACTFAA, (string not UTF\-8, folded |
| 721 |
\& except: MICRO, SHARP S; folded length <= |
| 722 |
\& unfolded, not currently trie\-able) |
| 723 |
\& |
| 724 |
\& EXACTFUP str Like EXACT, but match using /iu rules; |
| 725 |
\& (string not UTF\-8, folded except MICRO: |
| 726 |
\& hence Problematic) |
| 727 |
\& |
| 728 |
\& EXACTFLU8 str Like EXACTFU, but use /il, UTF\-8, (string |
| 729 |
\& is folded, and everything in it is above |
| 730 |
\& 255 |
| 731 |
\& EXACT_REQ8 str Like EXACT, but only UTF\-8 encoded targets |
| 732 |
\& can match |
| 733 |
\& LEXACT_REQ8 len:str 1 Like LEXACT, but only UTF\-8 encoded targets |
| 734 |
\& can match |
| 735 |
\& EXACTFU_REQ8 str Like EXACTFU, but only UTF\-8 encoded |
| 736 |
\& targets can match |
| 737 |
\& |
| 738 |
\& EXACTFU_S_EDGE str /di rules, but nothing in it precludes /ui, |
| 739 |
\& except begins and/or ends with [Ss]; |
| 740 |
\& (string not UTF\-8; compile\-time only) |
| 741 |
\& |
| 742 |
\& # New charclass like patterns |
| 743 |
\& LNBREAK none generic newline pattern |
| 744 |
\& |
| 745 |
\& # Trie Related |
| 746 |
\& |
| 747 |
\& # Behave the same as A|LIST|OF|WORDS would. The \*(Aq..C\*(Aq variants |
| 748 |
\& # have inline charclass data (ascii only), the \*(AqC\*(Aq store it in the |
| 749 |
\& # structure. |
| 750 |
\& |
| 751 |
\& TRIE trie 1 Match many EXACT(F[ALU]?)? at once. |
| 752 |
\& flags==type |
| 753 |
\& TRIEC trie Same as TRIE, but with embedded charclass |
| 754 |
\& charclass data |
| 755 |
\& |
| 756 |
\& AHOCORASICK trie 1 Aho Corasick stclass. flags==type |
| 757 |
\& AHOCORASICKC trie Same as AHOCORASICK, but with embedded |
| 758 |
\& charclass charclass data |
| 759 |
\& |
| 760 |
\& # Do nothing types |
| 761 |
\& |
| 762 |
\& NOTHING no Match empty string. |
| 763 |
\& # A variant of above which delimits a group, thus stops optimizations |
| 764 |
\& TAIL no Match empty string. Can jump here from |
| 765 |
\& outside. |
| 766 |
\& |
| 767 |
\& # Loops |
| 768 |
\& |
| 769 |
\& # STAR,PLUS \*(Aq?\*(Aq, and complex \*(Aq*\*(Aq and \*(Aq+\*(Aq, are implemented as |
| 770 |
\& # circular BRANCH structures. Simple cases |
| 771 |
\& # (one character per match) are implemented with STAR |
| 772 |
\& # and PLUS for speed and to minimize recursive plunges. |
| 773 |
\& # |
| 774 |
\& STAR node Match this (simple) thing 0 or more times: |
| 775 |
\& /A{0,}B/ where A is width 1 char |
| 776 |
\& PLUS node Match this (simple) thing 1 or more times: |
| 777 |
\& /A{1,}B/ where A is width 1 char |
| 778 |
\& |
| 779 |
\& CURLY sv 3 Match this (simple) thing {n,m} times: |
| 780 |
\& /A{m,n}B/ where A is width 1 char |
| 781 |
\& CURLYN no 3 Capture next\-after\-this simple thing: |
| 782 |
\& /(A){m,n}B/ where A is width 1 char |
| 783 |
\& CURLYM no 3 Capture this medium\-complex thing {n,m} |
| 784 |
\& times: /(A){m,n}B/ where A is fixed\-length |
| 785 |
\& CURLYX sv 3 Match/Capture this complex thing {n,m} |
| 786 |
\& times. |
| 787 |
\& |
| 788 |
\& # This terminator creates a loop structure for CURLYX |
| 789 |
\& WHILEM no Do curly processing and see if rest |
| 790 |
\& matches. |
| 791 |
\& |
| 792 |
\& # Buffer related |
| 793 |
\& |
| 794 |
\& # OPEN,CLOSE,GROUPP ...are numbered at compile time. |
| 795 |
\& OPEN num 1 Mark this point in input as start of #n. |
| 796 |
\& CLOSE num 1 Close corresponding OPEN of #n. |
| 797 |
\& SROPEN none Same as OPEN, but for script run |
| 798 |
\& SRCLOSE none Close preceding SROPEN |
| 799 |
\& |
| 800 |
\& REF num 2 Match some already matched string |
| 801 |
\& REFF num 2 Match already matched string, using /di |
| 802 |
\& rules. |
| 803 |
\& REFFL num 2 Match already matched string, using /li |
| 804 |
\& rules. |
| 805 |
\& REFFU num 2 Match already matched string, usng /ui. |
| 806 |
\& REFFA num 2 Match already matched string, using /aai |
| 807 |
\& rules. |
| 808 |
\& |
| 809 |
\& # Named references. Code in regcomp.c assumes that these all are after |
| 810 |
\& # the numbered references |
| 811 |
\& REFN no\-sv 2 Match some already matched string |
| 812 |
\& REFFN no\-sv 2 Match already matched string, using /di |
| 813 |
\& rules. |
| 814 |
\& REFFLN no\-sv 2 Match already matched string, using /li |
| 815 |
\& rules. |
| 816 |
\& REFFUN num 2 Match already matched string, using /ui |
| 817 |
\& rules. |
| 818 |
\& REFFAN num 2 Match already matched string, using /aai |
| 819 |
\& rules. |
| 820 |
\& |
| 821 |
\& # Support for long RE |
| 822 |
\& LONGJMP off 1 1 Jump far away. |
| 823 |
\& BRANCHJ off 2 1 BRANCH with long offset. |
| 824 |
\& |
| 825 |
\& # Special Case Regops |
| 826 |
\& IFMATCH off 1 1 Succeeds if the following matches; non\-zero |
| 827 |
\& flags "f", next_off "o" means lookbehind |
| 828 |
\& assertion starting "f..(f\-o)" characters |
| 829 |
\& before current |
| 830 |
\& UNLESSM off 1 1 Fails if the following matches; non\-zero |
| 831 |
\& flags "f", next_off "o" means lookbehind |
| 832 |
\& assertion starting "f..(f\-o)" characters |
| 833 |
\& before current |
| 834 |
\& SUSPEND off 1 1 "Independent" sub\-RE. |
| 835 |
\& IFTHEN off 1 1 Switch, should be preceded by switcher. |
| 836 |
\& GROUPP num 1 Whether the group matched. |
| 837 |
\& |
| 838 |
\& # The heavy worker |
| 839 |
\& |
| 840 |
\& EVAL evl/flags Execute some Perl code. |
| 841 |
\& 2 |
| 842 |
\& |
| 843 |
\& # Modifiers |
| 844 |
\& |
| 845 |
\& MINMOD no Next operator is not greedy. |
| 846 |
\& LOGICAL no Next opcode should set the flag only. |
| 847 |
\& |
| 848 |
\& # This is not used yet |
| 849 |
\& RENUM off 1 1 Group with independently numbered parens. |
| 850 |
\& |
| 851 |
\& # Regex Subroutines |
| 852 |
\& GOSUB num/ofs 2 recurse to paren arg1 at (signed) ofs arg2 |
| 853 |
\& |
| 854 |
\& # Special conditionals |
| 855 |
\& GROUPPN no\-sv 1 Whether the group matched. |
| 856 |
\& INSUBP num 1 Whether we are in a specific recurse. |
| 857 |
\& DEFINEP none 1 Never execute directly. |
| 858 |
\& |
| 859 |
\& # Backtracking Verbs |
| 860 |
\& ENDLIKE none Used only for the type field of verbs |
| 861 |
\& OPFAIL no\-sv 1 Same as (?!), but with verb arg |
| 862 |
\& ACCEPT no\-sv/num Accepts the current matched string, with |
| 863 |
\& 2 verbar |
| 864 |
\& |
| 865 |
\& # Verbs With Arguments |
| 866 |
\& VERB no\-sv 1 Used only for the type field of verbs |
| 867 |
\& PRUNE no\-sv 1 Pattern fails at this startpoint if no\- |
| 868 |
\& backtracking through this |
| 869 |
\& MARKPOINT no\-sv 1 Push the current location for rollback by |
| 870 |
\& cut. |
| 871 |
\& SKIP no\-sv 1 On failure skip forward (to the mark) |
| 872 |
\& before retrying |
| 873 |
\& COMMIT no\-sv 1 Pattern fails outright if backtracking |
| 874 |
\& through this |
| 875 |
\& CUTGROUP no\-sv 1 On failure go to the next alternation in |
| 876 |
\& the group |
| 877 |
\& |
| 878 |
\& # Control what to keep in $&. |
| 879 |
\& KEEPS no $& begins here. |
| 880 |
\& |
| 881 |
\& # Validate that lookbehind IFMATCH and UNLESSM end at the right place |
| 882 |
\& LOOKBEHIND_END no Return from lookbehind (IFMATCH/UNLESSM) |
| 883 |
\& and validate position |
| 884 |
\& |
| 885 |
\& # SPECIAL REGOPS |
| 886 |
\& |
| 887 |
\& # This is not really a node, but an optimized away piece of a "long" |
| 888 |
\& # node. To simplify debugging output, we mark it as if it were a node |
| 889 |
\& OPTIMIZED off Placeholder for dump. |
| 890 |
\& |
| 891 |
\& # Special opcode with the property that no opcode in a compiled program |
| 892 |
\& # will ever be of this type. Thus it can be used as a flag value that |
| 893 |
\& # no other opcode has been seen. END is used similarly, in that an END |
| 894 |
\& # node cant be optimized. So END implies "unoptimizable" and PSEUDO |
| 895 |
\& # mean "not seen anything to optimize yet". |
| 896 |
\& PSEUDO off Pseudo opcode for internal use. |
| 897 |
\& |
| 898 |
\& REGEX_SET depth p Regex set, temporary node used in pre\- |
| 899 |
\& optimization compilation |
| 900 |
.Ve |
| 901 |
.PP |
| 902 |
Following the optimizer information is a dump of the offset/length |
| 903 |
table, here split across several lines: |
| 904 |
.PP |
| 905 |
.Vb 5 |
| 906 |
\& Offsets: [45] |
| 907 |
\& 1[4] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 5[1] |
| 908 |
\& 0[0] 12[1] 0[0] 6[1] 0[0] 7[1] 0[0] 9[1] 8[1] 0[0] 10[1] 0[0] |
| 909 |
\& 11[1] 0[0] 12[0] 12[0] 13[1] 0[0] 14[4] 0[0] 0[0] 0[0] 0[0] |
| 910 |
\& 0[0] 0[0] 0[0] 0[0] 0[0] 0[0] 18[1] 0[0] 19[1] 20[0] |
| 911 |
.Ve |
| 912 |
.PP |
| 913 |
The first line here indicates that the offset/length table contains 45 |
| 914 |
entries. Each entry is a pair of integers, denoted by \f(CW\*(C`offset[length]\*(C'\fR. |
| 915 |
Entries are numbered starting with 1, so entry #1 here is \f(CW\*(C`1[4]\*(C'\fR and |
| 916 |
entry #12 is \f(CW\*(C`5[1]\*(C'\fR. \f(CW\*(C`1[4]\*(C'\fR indicates that the node labeled \f(CW\*(C`1:\*(C'\fR |
| 917 |
(the \f(CW\*(C`1: ANYOF[bc]\*(C'\fR) begins at character position 1 in the |
| 918 |
pre-compiled form of the regex, and has a length of 4 characters. |
| 919 |
\&\f(CW\*(C`5[1]\*(C'\fR in position 12 |
| 920 |
indicates that the node labeled \f(CW\*(C`12:\*(C'\fR |
| 921 |
(the \f(CW\*(C`12: EXACT <d>\*(C'\fR) begins at character position 5 in the |
| 922 |
pre-compiled form of the regex, and has a length of 1 character. |
| 923 |
\&\f(CW\*(C`12[1]\*(C'\fR in position 14 |
| 924 |
indicates that the node labeled \f(CW\*(C`14:\*(C'\fR |
| 925 |
(the \f(CW\*(C`14: CURLYX[0] {1,32767}\*(C'\fR) begins at character position 12 in the |
| 926 |
pre-compiled form of the regex, and has a length of 1 character\-\-\-that |
| 927 |
is, it corresponds to the \f(CW\*(C`+\*(C'\fR symbol in the precompiled regex. |
| 928 |
.PP |
| 929 |
\&\f(CW\*(C`0[0]\*(C'\fR items indicate that there is no corresponding node. |
| 930 |
.SS "Run-time Output" |
| 931 |
.IX Subsection "Run-time Output" |
| 932 |
First of all, when doing a match, one may get no run-time output even |
| 933 |
if debugging is enabled. This means that the regex engine was never |
| 934 |
entered and that all of the job was therefore done by the optimizer. |
| 935 |
.PP |
| 936 |
If the regex engine was entered, the output may look like this: |
| 937 |
.PP |
| 938 |
.Vb 10 |
| 939 |
\& Matching \*(Aq[bc]d(ef*g)+h[ij]k$\*(Aq against \*(Aqabcdefg_\|_gh_\|_\*(Aq |
| 940 |
\& Setting an EVAL scope, savestack=3 |
| 941 |
\& 2 <ab> <cdefg_\|_gh_> | 1: ANYOF |
| 942 |
\& 3 <abc> <defg_\|_gh_> | 11: EXACT <d> |
| 943 |
\& 4 <abcd> <efg_\|_gh_> | 13: CURLYX {1,32767} |
| 944 |
\& 4 <abcd> <efg_\|_gh_> | 26: WHILEM |
| 945 |
\& 0 out of 1..32767 cc=effff31c |
| 946 |
\& 4 <abcd> <efg_\|_gh_> | 15: OPEN1 |
| 947 |
\& 4 <abcd> <efg_\|_gh_> | 17: EXACT <e> |
| 948 |
\& 5 <abcde> <fg_\|_gh_> | 19: STAR |
| 949 |
\& EXACT <f> can match 1 times out of 32767... |
| 950 |
\& Setting an EVAL scope, savestack=3 |
| 951 |
\& 6 <bcdef> <g_\|_gh_\|_> | 22: EXACT <g> |
| 952 |
\& 7 <bcdefg> <_\|_gh_\|_> | 24: CLOSE1 |
| 953 |
\& 7 <bcdefg> <_\|_gh_\|_> | 26: WHILEM |
| 954 |
\& 1 out of 1..32767 cc=effff31c |
| 955 |
\& Setting an EVAL scope, savestack=12 |
| 956 |
\& 7 <bcdefg> <_\|_gh_\|_> | 15: OPEN1 |
| 957 |
\& 7 <bcdefg> <_\|_gh_\|_> | 17: EXACT <e> |
| 958 |
\& restoring \e1 to 4(4)..7 |
| 959 |
\& failed, try continuation... |
| 960 |
\& 7 <bcdefg> <_\|_gh_\|_> | 27: NOTHING |
| 961 |
\& 7 <bcdefg> <_\|_gh_\|_> | 28: EXACT <h> |
| 962 |
\& failed... |
| 963 |
\& failed... |
| 964 |
.Ve |
| 965 |
.PP |
| 966 |
The most significant information in the output is about the particular \fInode\fR |
| 967 |
of the compiled regex that is currently being tested against the target string. |
| 968 |
The format of these lines is |
| 969 |
.PP |
| 970 |
\&\f(CW\*(C` \*(C'\fR\fISTRING-OFFSET\fR <\fIPRE-STRING\fR> <\fIPOST-STRING\fR> |\fIID\fR: \fITYPE\fR |
| 971 |
.PP |
| 972 |
The \fITYPE\fR info is indented with respect to the backtracking level. |
| 973 |
Other incidental information appears interspersed within. |
| 974 |
.SH "Debugging Perl Memory Usage" |
| 975 |
.IX Header "Debugging Perl Memory Usage" |
| 976 |
Perl is a profligate wastrel when it comes to memory use. There |
| 977 |
is a saying that to estimate memory usage of Perl, assume a reasonable |
| 978 |
algorithm for memory allocation, multiply that estimate by 10, and |
| 979 |
while you still may miss the mark, at least you won't be quite so |
| 980 |
astonished. This is not absolutely true, but may provide a good |
| 981 |
grasp of what happens. |
| 982 |
.PP |
| 983 |
Assume that an integer cannot take less than 20 bytes of memory, a |
| 984 |
float cannot take less than 24 bytes, a string cannot take less |
| 985 |
than 32 bytes (all these examples assume 32\-bit architectures, the |
| 986 |
result are quite a bit worse on 64\-bit architectures). If a variable |
| 987 |
is accessed in two of three different ways (which require an integer, |
| 988 |
a float, or a string), the memory footprint may increase yet another |
| 989 |
20 bytes. A sloppy \fBmalloc\fR\|(3) implementation can inflate these |
| 990 |
numbers dramatically. |
| 991 |
.PP |
| 992 |
On the opposite end of the scale, a declaration like |
| 993 |
.PP |
| 994 |
.Vb 1 |
| 995 |
\& sub foo; |
| 996 |
.Ve |
| 997 |
.PP |
| 998 |
may take up to 500 bytes of memory, depending on which release of Perl |
| 999 |
you're running. |
| 1000 |
.PP |
| 1001 |
Anecdotal estimates of source-to-compiled code bloat suggest an |
| 1002 |
eightfold increase. This means that the compiled form of reasonable |
| 1003 |
(normally commented, properly indented etc.) code will take |
| 1004 |
about eight times more space in memory than the code took |
| 1005 |
on disk. |
| 1006 |
.PP |
| 1007 |
The \fB\-DL\fR command-line switch is obsolete since circa Perl 5.6.0 |
| 1008 |
(it was available only if Perl was built with \f(CW\*(C`\-DDEBUGGING\*(C'\fR). |
| 1009 |
The switch was used to track Perl's memory allocations and possible |
| 1010 |
memory leaks. These days the use of malloc debugging tools like |
| 1011 |
\&\fIPurify\fR or \fIvalgrind\fR is suggested instead. See also |
| 1012 |
"PERL_MEM_LOG" in perlhacktips. |
| 1013 |
.PP |
| 1014 |
One way to find out how much memory is being used by Perl data |
| 1015 |
structures is to install the Devel::Size module from CPAN: it gives |
| 1016 |
you the minimum number of bytes required to store a particular data |
| 1017 |
structure. Please be mindful of the difference between the \fBsize()\fR |
| 1018 |
and \fBtotal_size()\fR. |
| 1019 |
.PP |
| 1020 |
If Perl has been compiled using Perl's malloc you can analyze Perl |
| 1021 |
memory usage by setting \f(CW$ENV\fR{PERL_DEBUG_MSTATS}. |
| 1022 |
.ie n .SS "Using $ENV{PERL_DEBUG_MSTATS}" |
| 1023 |
.el .SS "Using \f(CW$ENV{PERL_DEBUG_MSTATS}\fP" |
| 1024 |
.IX Subsection "Using $ENV{PERL_DEBUG_MSTATS}" |
| 1025 |
If your perl is using Perl's \fBmalloc()\fR and was compiled with the |
| 1026 |
necessary switches (this is the default), then it will print memory |
| 1027 |
usage statistics after compiling your code when \f(CW\*(C`$ENV{PERL_DEBUG_MSTATS} |
| 1028 |
> 1\*(C'\fR, and before termination of the program when \f(CW\*(C`$ENV{PERL_DEBUG_MSTATS} >= 1\*(C'\fR. The report format is similar to |
| 1029 |
the following example: |
| 1030 |
.PP |
| 1031 |
.Vb 10 |
| 1032 |
\& $ PERL_DEBUG_MSTATS=2 perl \-e "require Carp" |
| 1033 |
\& Memory allocation statistics after compilation: (buckets 4(4)..8188(8192) |
| 1034 |
\& 14216 free: 130 117 28 7 9 0 2 2 1 0 0 |
| 1035 |
\& 437 61 36 0 5 |
| 1036 |
\& 60924 used: 125 137 161 55 7 8 6 16 2 0 1 |
| 1037 |
\& 74 109 304 84 20 |
| 1038 |
\& Total sbrk(): 77824/21:119. Odd ends: pad+heads+chain+tail: 0+636+0+2048. |
| 1039 |
\& Memory allocation statistics after execution: (buckets 4(4)..8188(8192) |
| 1040 |
\& 30888 free: 245 78 85 13 6 2 1 3 2 0 1 |
| 1041 |
\& 315 162 39 42 11 |
| 1042 |
\& 175816 used: 265 176 1112 111 26 22 11 27 2 1 1 |
| 1043 |
\& 196 178 1066 798 39 |
| 1044 |
\& Total sbrk(): 215040/47:145. Odd ends: pad+heads+chain+tail: 0+2192+0+6144. |
| 1045 |
.Ve |
| 1046 |
.PP |
| 1047 |
It is possible to ask for such a statistic at arbitrary points in |
| 1048 |
your execution using the \fBmstat()\fR function out of the standard |
| 1049 |
Devel::Peek module. |
| 1050 |
.PP |
| 1051 |
Here is some explanation of that format: |
| 1052 |
.ie n .IP """buckets SMALLEST(APPROX)..GREATEST(APPROX)""" 4 |
| 1053 |
.el .IP "\f(CWbuckets SMALLEST(APPROX)..GREATEST(APPROX)\fR" 4 |
| 1054 |
.IX Item "buckets SMALLEST(APPROX)..GREATEST(APPROX)" |
| 1055 |
Perl's \fBmalloc()\fR uses bucketed allocations. Every request is rounded |
| 1056 |
up to the closest bucket size available, and a bucket is taken from |
| 1057 |
the pool of buckets of that size. |
| 1058 |
.Sp |
| 1059 |
The line above describes the limits of buckets currently in use. |
| 1060 |
Each bucket has two sizes: memory footprint and the maximal size |
| 1061 |
of user data that can fit into this bucket. Suppose in the above |
| 1062 |
example that the smallest bucket were size 4. The biggest bucket |
| 1063 |
would have usable size 8188, and the memory footprint would be 8192. |
| 1064 |
.Sp |
| 1065 |
In a Perl built for debugging, some buckets may have negative usable |
| 1066 |
size. This means that these buckets cannot (and will not) be used. |
| 1067 |
For larger buckets, the memory footprint may be one page greater |
| 1068 |
than a power of 2. If so, the corresponding power of two is |
| 1069 |
printed in the \f(CW\*(C`APPROX\*(C'\fR field above. |
| 1070 |
.IP Free/Used 4 |
| 1071 |
.IX Item "Free/Used" |
| 1072 |
The 1 or 2 rows of numbers following that correspond to the number |
| 1073 |
of buckets of each size between \f(CW\*(C`SMALLEST\*(C'\fR and \f(CW\*(C`GREATEST\*(C'\fR. In |
| 1074 |
the first row, the sizes (memory footprints) of buckets are powers |
| 1075 |
of two\-\-or possibly one page greater. In the second row, if present, |
| 1076 |
the memory footprints of the buckets are between the memory footprints |
| 1077 |
of two buckets "above". |
| 1078 |
.Sp |
| 1079 |
For example, suppose under the previous example, the memory footprints |
| 1080 |
were |
| 1081 |
.Sp |
| 1082 |
.Vb 2 |
| 1083 |
\& free: 8 16 32 64 128 256 512 1024 2048 4096 8192 |
| 1084 |
\& 4 12 24 48 80 |
| 1085 |
.Ve |
| 1086 |
.Sp |
| 1087 |
With a non\-\f(CW\*(C`DEBUGGING\*(C'\fR perl, the buckets starting from \f(CW128\fR have |
| 1088 |
a 4\-byte overhead, and thus an 8192\-long bucket may take up to |
| 1089 |
8188\-byte allocations. |
| 1090 |
.ie n .IP """Total sbrk(): SBRKed/SBRKs:CONTINUOUS""" 4 |
| 1091 |
.el .IP "\f(CWTotal sbrk(): SBRKed/SBRKs:CONTINUOUS\fR" 4 |
| 1092 |
.IX Item "Total sbrk(): SBRKed/SBRKs:CONTINUOUS" |
| 1093 |
The first two fields give the total amount of memory perl \fBsbrk\fR\|(2)ed |
| 1094 |
(ess-broken? :\-) and number of \fBsbrk\fR\|(2)s used. The third number is |
| 1095 |
what perl thinks about continuity of returned chunks. So long as |
| 1096 |
this number is positive, \fBmalloc()\fR will assume that it is probable |
| 1097 |
that \fBsbrk\fR\|(2) will provide continuous memory. |
| 1098 |
.Sp |
| 1099 |
Memory allocated by external libraries is not counted. |
| 1100 |
.ie n .IP """pad: 0""" 4 |
| 1101 |
.el .IP "\f(CWpad: 0\fR" 4 |
| 1102 |
.IX Item "pad: 0" |
| 1103 |
The amount of \fBsbrk\fR\|(2)ed memory needed to keep buckets aligned. |
| 1104 |
.ie n .IP """heads: 2192""" 4 |
| 1105 |
.el .IP "\f(CWheads: 2192\fR" 4 |
| 1106 |
.IX Item "heads: 2192" |
| 1107 |
Although memory overhead of bigger buckets is kept inside the bucket, for |
| 1108 |
smaller buckets, it is kept in separate areas. This field gives the |
| 1109 |
total size of these areas. |
| 1110 |
.ie n .IP """chain: 0""" 4 |
| 1111 |
.el .IP "\f(CWchain: 0\fR" 4 |
| 1112 |
.IX Item "chain: 0" |
| 1113 |
\&\fBmalloc()\fR may want to subdivide a bigger bucket into smaller buckets. |
| 1114 |
If only a part of the deceased bucket is left unsubdivided, the rest |
| 1115 |
is kept as an element of a linked list. This field gives the total |
| 1116 |
size of these chunks. |
| 1117 |
.ie n .IP """tail: 6144""" 4 |
| 1118 |
.el .IP "\f(CWtail: 6144\fR" 4 |
| 1119 |
.IX Item "tail: 6144" |
| 1120 |
To minimize the number of \fBsbrk\fR\|(2)s, \fBmalloc()\fR asks for more memory. This |
| 1121 |
field gives the size of the yet unused part, which is \fBsbrk\fR\|(2)ed, but |
| 1122 |
never touched. |
| 1123 |
.SH "SEE ALSO" |
| 1124 |
.IX Header "SEE ALSO" |
| 1125 |
perldebug, |
| 1126 |
perl5db.pl, |
| 1127 |
perlguts, |
| 1128 |
perlrun, |
| 1129 |
re, |
| 1130 |
and |
| 1131 |
Devel::DProf. |