Debian Codegraph @

upstream/opensuse-tumbleweed/man3/DB.3pm

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man v6.0.2 (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 .\" Required to disable full justification in groff 1.23.0.
57 .if n .ds AD l
58 .\" ========================================================================
59 .\"
60 .IX Title "DB 3pm"
61 .TH DB 3pm 2026-03-09 "perl v5.42.1" "Perl Programmers Reference Guide"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .if n .ad l
65 .nh
66 .SH NAME
67 DB \- programmatic interface to the Perl debugging API
68 .SH SYNOPSIS
69 .IX Header "SYNOPSIS"
70 .Vb 3
71 \& package CLIENT;
72 \& use DB;
73 \& @ISA = qw(DB);
74 \&
75 \& # these (inherited) methods can be called by the client
76 \&
77 \& CLIENT\->register() # register a client package name
78 \& CLIENT\->done() # de\-register from the debugging API
79 \& CLIENT\->skippkg(\*(Aqhide::hide\*(Aq) # ask DB not to stop in this package
80 \& CLIENT\->cont([WHERE]) # run some more (until BREAK or
81 \& # another breakpoint)
82 \& CLIENT\->step() # single step
83 \& CLIENT\->next() # step over
84 \& CLIENT\->ret() # return from current subroutine
85 \& CLIENT\->backtrace() # return the call stack description
86 \& CLIENT\->ready() # call when client setup is done
87 \& CLIENT\->trace_toggle() # toggle subroutine call trace mode
88 \& CLIENT\->subs([SUBS]) # return subroutine information
89 \& CLIENT\->files() # return list of all files known to DB
90 \& CLIENT\->lines() # return lines in currently loaded file
91 \& CLIENT\->loadfile(FILE,LINE) # load a file and let other clients know
92 \& CLIENT\->lineevents() # return info on lines with actions
93 \& CLIENT\->set_break([WHERE],[COND])
94 \& CLIENT\->set_tbreak([WHERE])
95 \& CLIENT\->clr_breaks([LIST])
96 \& CLIENT\->set_action(WHERE,ACTION)
97 \& CLIENT\->clr_actions([LIST])
98 \& CLIENT\->evalcode(STRING) # eval STRING in executing code\*(Aqs context
99 \& CLIENT\->prestop([STRING]) # execute in code context before stopping
100 \& CLIENT\->poststop([STRING])# execute in code context before resuming
101 \&
102 \& # These methods will be called at the appropriate times.
103 \& # Stub versions provided do nothing.
104 \& # None of these can block.
105 \&
106 \& CLIENT\->init() # called when debug API inits itself
107 \& CLIENT\->stop(FILE,LINE) # when execution stops
108 \& CLIENT\->idle() # while stopped (can be a client event loop)
109 \& CLIENT\->cleanup() # just before exit
110 \& CLIENT\->output(LIST) # called to print any output that
111 \& # the API must show
112 .Ve
113 .SH DESCRIPTION
114 .IX Header "DESCRIPTION"
115 Perl debug information is frequently required not just by debuggers,
116 but also by modules that need some "special" information to do their
117 job properly, like profilers.
118 .PP
119 This module abstracts and provides all of the hooks into Perl internal
120 debugging functionality, so that various implementations of Perl debuggers
121 (or packages that want to simply get at the "privileged" debugging data)
122 can all benefit from the development of this common code. Currently used
123 by Swat, the perl/Tk GUI debugger.
124 .PP
125 Note that multiple "front\-ends" can latch into this debugging API
126 simultaneously. This is intended to facilitate things like
127 debugging with a command line and GUI at the same time, debugging
128 debuggers etc. [Sounds nice, but this needs some serious support \-\- GSAR]
129 .PP
130 In particular, this API does \fBnot\fR provide the following functions:
131 .IP \(bu 4
132 data display
133 .IP \(bu 4
134 command processing
135 .IP \(bu 4
136 command alias management
137 .IP \(bu 4
138 user interface (tty or graphical)
139 .PP
140 These are intended to be services performed by the clients of this API.
141 .PP
142 This module attempts to be squeaky clean w.r.t \f(CW\*(C`use strict;\*(C'\fR and when
143 warnings are enabled.
144 .SS "Global Variables"
145 .IX Subsection "Global Variables"
146 The following "public" global names can be read by clients of this API.
147 Beware that these should be considered "readonly".
148 .ie n .IP $DB::sub 8
149 .el .IP \f(CW$DB::sub\fR 8
150 .IX Item "$DB::sub"
151 Name of current executing subroutine.
152 .ie n .IP %DB::sub 8
153 .el .IP \f(CW%DB::sub\fR 8
154 .IX Item "%DB::sub"
155 The keys of this hash are the names of all the known subroutines. Each value
156 is an encoded string that has the \fBsprintf\fR\|(3) format
157 \&\f(CW\*(C`("%s:%d\-%d", filename, fromline, toline)\*(C'\fR.
158 .ie n .IP $DB::single 8
159 .el .IP \f(CW$DB::single\fR 8
160 .IX Item "$DB::single"
161 Single\-step flag. Will be true if the API will stop at the next statement.
162 .ie n .IP $DB::signal 8
163 .el .IP \f(CW$DB::signal\fR 8
164 .IX Item "$DB::signal"
165 Signal flag. Will be set to a true value if a signal was caught. Clients may
166 check for this flag to abort time\-consuming operations.
167 .ie n .IP $DB::trace 8
168 .el .IP \f(CW$DB::trace\fR 8
169 .IX Item "$DB::trace"
170 This flag is set to true if the API is tracing through subroutine calls.
171 .ie n .IP @DB::args 8
172 .el .IP \f(CW@DB::args\fR 8
173 .IX Item "@DB::args"
174 Contains the arguments of current subroutine, or the \f(CW@ARGV\fR array if in the
175 toplevel context.
176 .ie n .IP @DB::dbline 8
177 .el .IP \f(CW@DB::dbline\fR 8
178 .IX Item "@DB::dbline"
179 List of lines in currently loaded file.
180 .ie n .IP %DB::dbline 8
181 .el .IP \f(CW%DB::dbline\fR 8
182 .IX Item "%DB::dbline"
183 Actions in current file (keys are line numbers). The values are strings that
184 have the \fBsprintf\fR\|(3) format \f(CW\*(C`("%s\e000%s", breakcondition, actioncode)\*(C'\fR.
185 .ie n .IP $DB::package 8
186 .el .IP \f(CW$DB::package\fR 8
187 .IX Item "$DB::package"
188 Package namespace of currently executing code.
189 .ie n .IP $DB::filename 8
190 .el .IP \f(CW$DB::filename\fR 8
191 .IX Item "$DB::filename"
192 Currently loaded filename.
193 .ie n .IP $DB::subname 8
194 .el .IP \f(CW$DB::subname\fR 8
195 .IX Item "$DB::subname"
196 Fully qualified name of currently executing subroutine.
197 .ie n .IP $DB::lineno 8
198 .el .IP \f(CW$DB::lineno\fR 8
199 .IX Item "$DB::lineno"
200 Line number that will be executed next.
201 .SS "API Methods"
202 .IX Subsection "API Methods"
203 The following are methods in the DB base class. A client must
204 access these methods by inheritance (*not* by calling them directly),
205 since the API keeps track of clients through the inheritance
206 mechanism.
207 .IP CLIENT\->\fBregister()\fR 8
208 .IX Item "CLIENT->register()"
209 register a client object/package
210 .IP CLIENT\->evalcode(STRING) 8
211 .IX Item "CLIENT->evalcode(STRING)"
212 eval STRING in executing code context
213 .IP CLIENT\->skippkg(\*(AqD::hide\*(Aq) 8
214 .IX Item "CLIENT->skippkg('D::hide')"
215 ask DB not to stop in these packages
216 .IP CLIENT\->\fBrun()\fR 8
217 .IX Item "CLIENT->run()"
218 run some more (until a breakpt is reached)
219 .IP CLIENT\->\fBstep()\fR 8
220 .IX Item "CLIENT->step()"
221 single step
222 .IP CLIENT\->\fBnext()\fR 8
223 .IX Item "CLIENT->next()"
224 step over
225 .IP CLIENT\->\fBdone()\fR 8
226 .IX Item "CLIENT->done()"
227 de\-register from the debugging API
228 .SS "Client Callback Methods"
229 .IX Subsection "Client Callback Methods"
230 The following "virtual" methods can be defined by the client. They will
231 be called by the API at appropriate points. Note that unless specified
232 otherwise, the debug API only defines empty, non\-functional default versions
233 of these methods.
234 .IP CLIENT\->\fBinit()\fR 8
235 .IX Item "CLIENT->init()"
236 Called after debug API inits itself.
237 .IP CLIENT\->prestop([STRING]) 8
238 .IX Item "CLIENT->prestop([STRING])"
239 Usually inherited from DB package. If no arguments are passed,
240 returns the prestop action string.
241 .IP CLIENT\->\fBstop()\fR 8
242 .IX Item "CLIENT->stop()"
243 Called when execution stops (w/ args file, line).
244 .IP CLIENT\->\fBidle()\fR 8
245 .IX Item "CLIENT->idle()"
246 Called while stopped (can be a client event loop).
247 .IP CLIENT\->poststop([STRING]) 8
248 .IX Item "CLIENT->poststop([STRING])"
249 Usually inherited from DB package. If no arguments are passed,
250 returns the poststop action string.
251 .IP CLIENT\->evalcode(STRING) 8
252 .IX Item "CLIENT->evalcode(STRING)"
253 Usually inherited from DB package. Ask for a STRING to be \f(CW\*(C`eval\*(C'\fR\-ed
254 in executing code context.
255 .IP CLIENT\->\fBcleanup()\fR 8
256 .IX Item "CLIENT->cleanup()"
257 Called just before exit.
258 .IP CLIENT\->output(LIST) 8
259 .IX Item "CLIENT->output(LIST)"
260 Called when API must show a message (warnings, errors etc.).
261 .SH BUGS
262 .IX Header "BUGS"
263 The interface defined by this module is missing some of the later additions
264 to perl\*(Aqs debugging functionality. As such, this interface should be considered
265 highly experimental and subject to change.
266 .SH AUTHOR
267 .IX Header "AUTHOR"
268 Gurusamy Sarathy [email protected]
269 .PP
270 This code heavily adapted from an early version of perl5db.pl attributable
271 to Larry Wall and the Perl Porters.