Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 |
2 | .\" | |
3 | .\" Standard preamble: | |
4 | .\" ======================================================================== | |
5 | .de Sh \" Subsection heading | |
6 | .br | |
7 | .if t .Sp | |
8 | .ne 5 | |
9 | .PP | |
10 | \fB\\$1\fR | |
11 | .PP | |
12 | .. | |
13 | .de Sp \" Vertical space (when we can't use .PP) | |
14 | .if t .sp .5v | |
15 | .if n .sp | |
16 | .. | |
17 | .de Vb \" Begin verbatim text | |
18 | .ft CW | |
19 | .nf | |
20 | .ne \\$1 | |
21 | .. | |
22 | .de Ve \" End verbatim text | |
23 | .ft R | |
24 | .fi | |
25 | .. | |
26 | .\" Set up some character translations and predefined strings. \*(-- will | |
27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left | |
28 | .\" double quote, and \*(R" will give a right double quote. | will give a | |
29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to | |
30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' | |
31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. | |
32 | .tr \(*W-|\(bv\*(Tr | |
33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | |
34 | .ie n \{\ | |
35 | . ds -- \(*W- | |
36 | . ds PI pi | |
37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch | |
38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch | |
39 | . ds L" "" | |
40 | . ds R" "" | |
41 | . ds C` "" | |
42 | . ds C' "" | |
43 | 'br\} | |
44 | .el\{\ | |
45 | . ds -- \|\(em\| | |
46 | . ds PI \(*p | |
47 | . ds L" `` | |
48 | . ds R" '' | |
49 | 'br\} | |
50 | .\" | |
51 | .\" If the F register is turned on, we'll generate index entries on stderr for | |
52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | |
53 | .\" entries marked with X<> in POD. Of course, you'll have to process the | |
54 | .\" output yourself in some meaningful fashion. | |
55 | .if \nF \{\ | |
56 | . de IX | |
57 | . tm Index:\\$1\t\\n%\t"\\$2" | |
58 | .. | |
59 | . nr % 0 | |
60 | . rr F | |
61 | .\} | |
62 | .\" | |
63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes | |
64 | .\" way too many mistakes in technical documents. | |
65 | .hy 0 | |
66 | .if n .na | |
67 | .\" | |
68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | |
69 | .\" Fear. Run. Save yourself. No user-serviceable parts. | |
70 | . \" fudge factors for nroff and troff | |
71 | .if n \{\ | |
72 | . ds #H 0 | |
73 | . ds #V .8m | |
74 | . ds #F .3m | |
75 | . ds #[ \f1 | |
76 | . ds #] \fP | |
77 | .\} | |
78 | .if t \{\ | |
79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | |
80 | . ds #V .6m | |
81 | . ds #F 0 | |
82 | . ds #[ \& | |
83 | . ds #] \& | |
84 | .\} | |
85 | . \" simple accents for nroff and troff | |
86 | .if n \{\ | |
87 | . ds ' \& | |
88 | . ds ` \& | |
89 | . ds ^ \& | |
90 | . ds , \& | |
91 | . ds ~ ~ | |
92 | . ds / | |
93 | .\} | |
94 | .if t \{\ | |
95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | |
96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | |
97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | |
98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | |
99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | |
100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | |
101 | .\} | |
102 | . \" troff and (daisy-wheel) nroff accents | |
103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | |
104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | |
105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | |
106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | |
107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | |
108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | |
109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | |
110 | .ds ae a\h'-(\w'a'u*4/10)'e | |
111 | .ds Ae A\h'-(\w'A'u*4/10)'E | |
112 | . \" corrections for vroff | |
113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | |
114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | |
115 | . \" for low resolution devices (crt and lpr) | |
116 | .if \n(.H>23 .if \n(.V>19 \ | |
117 | \{\ | |
118 | . ds : e | |
119 | . ds 8 ss | |
120 | . ds o a | |
121 | . ds d- d\h'-1'\(ga | |
122 | . ds D- D\h'-1'\(hy | |
123 | . ds th \o'bp' | |
124 | . ds Th \o'LP' | |
125 | . ds ae ae | |
126 | . ds Ae AE | |
127 | .\} | |
128 | .rm #[ #] #H #V #F C | |
129 | .\" ======================================================================== | |
130 | .\" | |
131 | .IX Title "DB 3" | |
132 | .TH DB 3 "2001-09-21" "perl v5.8.8" "Perl Programmers Reference Guide" | |
133 | .SH "NAME" | |
134 | DB \- programmatic interface to the Perl debugging API (draft, subject to | |
135 | change) | |
136 | .SH "SYNOPSIS" | |
137 | .IX Header "SYNOPSIS" | |
138 | .Vb 3 | |
139 | \& package CLIENT; | |
140 | \& use DB; | |
141 | \& @ISA = qw(DB); | |
142 | .Ve | |
143 | .PP | |
144 | .Vb 1 | |
145 | \& # these (inherited) methods can be called by the client | |
146 | .Ve | |
147 | .PP | |
148 | .Vb 23 | |
149 | \& CLIENT->register() # register a client package name | |
150 | \& CLIENT->done() # de-register from the debugging API | |
151 | \& CLIENT->skippkg('hide::hide') # ask DB not to stop in this package | |
152 | \& CLIENT->cont([WHERE]) # run some more (until BREAK or another breakpt) | |
153 | \& CLIENT->step() # single step | |
154 | \& CLIENT->next() # step over | |
155 | \& CLIENT->ret() # return from current subroutine | |
156 | \& CLIENT->backtrace() # return the call stack description | |
157 | \& CLIENT->ready() # call when client setup is done | |
158 | \& CLIENT->trace_toggle() # toggle subroutine call trace mode | |
159 | \& CLIENT->subs([SUBS]) # return subroutine information | |
160 | \& CLIENT->files() # return list of all files known to DB | |
161 | \& CLIENT->lines() # return lines in currently loaded file | |
162 | \& CLIENT->loadfile(FILE,LINE) # load a file and let other clients know | |
163 | \& CLIENT->lineevents() # return info on lines with actions | |
164 | \& CLIENT->set_break([WHERE],[COND]) | |
165 | \& CLIENT->set_tbreak([WHERE]) | |
166 | \& CLIENT->clr_breaks([LIST]) | |
167 | \& CLIENT->set_action(WHERE,ACTION) | |
168 | \& CLIENT->clr_actions([LIST]) | |
169 | \& CLIENT->evalcode(STRING) # eval STRING in executing code's context | |
170 | \& CLIENT->prestop([STRING]) # execute in code context before stopping | |
171 | \& CLIENT->poststop([STRING])# execute in code context before resuming | |
172 | .Ve | |
173 | .PP | |
174 | .Vb 3 | |
175 | \& # These methods will be called at the appropriate times. | |
176 | \& # Stub versions provided do nothing. | |
177 | \& # None of these can block. | |
178 | .Ve | |
179 | .PP | |
180 | .Vb 5 | |
181 | \& CLIENT->init() # called when debug API inits itself | |
182 | \& CLIENT->stop(FILE,LINE) # when execution stops | |
183 | \& CLIENT->idle() # while stopped (can be a client event loop) | |
184 | \& CLIENT->cleanup() # just before exit | |
185 | \& CLIENT->output(LIST) # called to print any output that API must show | |
186 | .Ve | |
187 | .SH "DESCRIPTION" | |
188 | .IX Header "DESCRIPTION" | |
189 | Perl debug information is frequently required not just by debuggers, | |
190 | but also by modules that need some \*(L"special\*(R" information to do their | |
191 | job properly, like profilers. | |
192 | .PP | |
193 | This module abstracts and provides all of the hooks into Perl internal | |
194 | debugging functionality, so that various implementations of Perl debuggers | |
195 | (or packages that want to simply get at the \*(L"privileged\*(R" debugging data) | |
196 | can all benefit from the development of this common code. Currently used | |
197 | by Swat, the perl/Tk \s-1GUI\s0 debugger. | |
198 | .PP | |
199 | Note that multiple \*(L"front\-ends\*(R" can latch into this debugging \s-1API\s0 | |
200 | simultaneously. This is intended to facilitate things like | |
201 | debugging with a command line and \s-1GUI\s0 at the same time, debugging | |
202 | debuggers etc. [Sounds nice, but this needs some serious support \*(-- \s-1GSAR\s0] | |
203 | .PP | |
204 | In particular, this \s-1API\s0 does \fBnot\fR provide the following functions: | |
205 | .IP "\(bu" 4 | |
206 | data display | |
207 | .IP "\(bu" 4 | |
208 | command processing | |
209 | .IP "\(bu" 4 | |
210 | command alias management | |
211 | .IP "\(bu" 4 | |
212 | user interface (tty or graphical) | |
213 | .PP | |
214 | These are intended to be services performed by the clients of this \s-1API\s0. | |
215 | .PP | |
216 | This module attempts to be squeaky clean w.r.t \f(CW\*(C`use strict;\*(C'\fR and when | |
217 | warnings are enabled. | |
218 | .Sh "Global Variables" | |
219 | .IX Subsection "Global Variables" | |
220 | The following \*(L"public\*(R" global names can be read by clients of this \s-1API\s0. | |
221 | Beware that these should be considered \*(L"readonly\*(R". | |
222 | .IP "$DB::sub" 8 | |
223 | .IX Item "$DB::sub" | |
224 | Name of current executing subroutine. | |
225 | .IP "%DB::sub" 8 | |
226 | .IX Item "%DB::sub" | |
227 | The keys of this hash are the names of all the known subroutines. Each value | |
228 | is an encoded string that has the \fIsprintf\fR\|(3) format | |
229 | \&\f(CW\*(C`("%s:%d\-%d", filename, fromline, toline)\*(C'\fR. | |
230 | .IP "$DB::single" 8 | |
231 | .IX Item "$DB::single" | |
232 | Single-step flag. Will be true if the \s-1API\s0 will stop at the next statement. | |
233 | .IP "$DB::signal" 8 | |
234 | .IX Item "$DB::signal" | |
235 | Signal flag. Will be set to a true value if a signal was caught. Clients may | |
236 | check for this flag to abort time-consuming operations. | |
237 | .IP "$DB::trace" 8 | |
238 | .IX Item "$DB::trace" | |
239 | This flag is set to true if the \s-1API\s0 is tracing through subroutine calls. | |
240 | .IP "@DB::args" 8 | |
241 | .IX Item "@DB::args" | |
242 | Contains the arguments of current subroutine, or the \f(CW@ARGV\fR array if in the | |
243 | toplevel context. | |
244 | .IP "@DB::dbline" 8 | |
245 | .IX Item "@DB::dbline" | |
246 | List of lines in currently loaded file. | |
247 | .IP "%DB::dbline" 8 | |
248 | .IX Item "%DB::dbline" | |
249 | Actions in current file (keys are line numbers). The values are strings that | |
250 | have the \fIsprintf\fR\|(3) format \f(CW\*(C`("%s\e000%s", breakcondition, actioncode)\*(C'\fR. | |
251 | .IP "$DB::package" 8 | |
252 | .IX Item "$DB::package" | |
253 | Package namespace of currently executing code. | |
254 | .IP "$DB::filename" 8 | |
255 | .IX Item "$DB::filename" | |
256 | Currently loaded filename. | |
257 | .IP "$DB::subname" 8 | |
258 | .IX Item "$DB::subname" | |
259 | Fully qualified name of currently executing subroutine. | |
260 | .IP "$DB::lineno" 8 | |
261 | .IX Item "$DB::lineno" | |
262 | Line number that will be executed next. | |
263 | .Sh "\s-1API\s0 Methods" | |
264 | .IX Subsection "API Methods" | |
265 | The following are methods in the \s-1DB\s0 base class. A client must | |
266 | access these methods by inheritance (*not* by calling them directly), | |
267 | since the \s-1API\s0 keeps track of clients through the inheritance | |
268 | mechanism. | |
269 | .IP "\s-1CLIENT\-\s0>\fIregister()\fR" 8 | |
270 | .IX Item "CLIENT->register()" | |
271 | register a client object/package | |
272 | .IP "\s-1CLIENT\-\s0>evalcode(\s-1STRING\s0)" 8 | |
273 | .IX Item "CLIENT->evalcode(STRING)" | |
274 | eval \s-1STRING\s0 in executing code context | |
275 | .IP "\s-1CLIENT\-\s0>skippkg('D::hide')" 8 | |
276 | .IX Item "CLIENT->skippkg('D::hide')" | |
277 | ask \s-1DB\s0 not to stop in these packages | |
278 | .IP "\s-1CLIENT\-\s0>\fIrun()\fR" 8 | |
279 | .IX Item "CLIENT->run()" | |
280 | run some more (until a breakpt is reached) | |
281 | .IP "\s-1CLIENT\-\s0>\fIstep()\fR" 8 | |
282 | .IX Item "CLIENT->step()" | |
283 | single step | |
284 | .IP "\s-1CLIENT\-\s0>\fInext()\fR" 8 | |
285 | .IX Item "CLIENT->next()" | |
286 | step over | |
287 | .IP "\s-1CLIENT\-\s0>\fIdone()\fR" 8 | |
288 | .IX Item "CLIENT->done()" | |
289 | de-register from the debugging \s-1API\s0 | |
290 | .Sh "Client Callback Methods" | |
291 | .IX Subsection "Client Callback Methods" | |
292 | The following \*(L"virtual\*(R" methods can be defined by the client. They will | |
293 | be called by the \s-1API\s0 at appropriate points. Note that unless specified | |
294 | otherwise, the debug \s-1API\s0 only defines empty, non-functional default versions | |
295 | of these methods. | |
296 | .IP "\s-1CLIENT\-\s0>\fIinit()\fR" 8 | |
297 | .IX Item "CLIENT->init()" | |
298 | Called after debug \s-1API\s0 inits itself. | |
299 | .IP "\s-1CLIENT\-\s0>prestop([\s-1STRING\s0])" 8 | |
300 | .IX Item "CLIENT->prestop([STRING])" | |
301 | Usually inherited from \s-1DB\s0 package. If no arguments are passed, | |
302 | returns the prestop action string. | |
303 | .IP "\s-1CLIENT\-\s0>\fIstop()\fR" 8 | |
304 | .IX Item "CLIENT->stop()" | |
305 | Called when execution stops (w/ args file, line). | |
306 | .IP "\s-1CLIENT\-\s0>\fIidle()\fR" 8 | |
307 | .IX Item "CLIENT->idle()" | |
308 | Called while stopped (can be a client event loop). | |
309 | .IP "\s-1CLIENT\-\s0>poststop([\s-1STRING\s0])" 8 | |
310 | .IX Item "CLIENT->poststop([STRING])" | |
311 | Usually inherited from \s-1DB\s0 package. If no arguments are passed, | |
312 | returns the poststop action string. | |
313 | .IP "\s-1CLIENT\-\s0>evalcode(\s-1STRING\s0)" 8 | |
314 | .IX Item "CLIENT->evalcode(STRING)" | |
315 | Usually inherited from \s-1DB\s0 package. Ask for a \s-1STRING\s0 to be \f(CW\*(C`eval\*(C'\fR\-ed | |
316 | in executing code context. | |
317 | .IP "\s-1CLIENT\-\s0>\fIcleanup()\fR" 8 | |
318 | .IX Item "CLIENT->cleanup()" | |
319 | Called just before exit. | |
320 | .IP "\s-1CLIENT\-\s0>output(\s-1LIST\s0)" 8 | |
321 | .IX Item "CLIENT->output(LIST)" | |
322 | Called when \s-1API\s0 must show a message (warnings, errors etc.). | |
323 | .SH "BUGS" | |
324 | .IX Header "BUGS" | |
325 | The interface defined by this module is missing some of the later additions | |
326 | to perl's debugging functionality. As such, this interface should be considered | |
327 | highly experimental and subject to change. | |
328 | .SH "AUTHOR" | |
329 | .IX Header "AUTHOR" | |
330 | Gurusamy Sarathy gsar@activestate.com | |
331 | .PP | |
332 | This code heavily adapted from an early version of perl5db.pl attributable | |
333 | to Larry Wall and the Perl Porters. |