1
<?xml version="1.0" encoding="ISO8859-1"?>
6
====================================================================
8
====================================================================
11
<module name="dbugintf">
12
<short>Unit to send commands to a debug server process</short>
15
Use <file>dbugintf</file> to add debug messages to your application.
16
The messages are not sent to standard output, but are sent to a debug server
17
process which collects messages from various clients and displays them
21
The unit is transparant in its use: it does not need initialization, it
22
will start the debug server by itself if it can find it: the program should
23
be called <file>debugserver</file> and should be in the <var>PATH</var>.
24
When the first debug message is sent, the unit will initialize itself.
27
The FCL contains a sample debug server (<file>dbugsvr</file>) which can be
28
started in advance, and which writes debug message to the console (both on
29
Windows and Linux). The Lazarus project contains a visual application which
30
displays the messages in a GUI.
33
The <file>dbugintf</file> unit relies on the <link id="SimpleIPC"/>
34
mechanism to communicate with the debug server, hence it works on all
35
platforms that have a functional version of that unit. It also uses
36
<var>TProcess</var> to start the debug server if needed, so the
37
<link id="process"/> unit should also be functional.
41
<topic name="debugservers">
42
<short>Writing a debug server</short>
45
Writing a debug server is relatively easy. It should instantiate a
46
<var>TSimpleIPCServer</var> class from the <link id="SimpleIPC"/> unit, and
47
use the <var>DebugServerID</var> as <var>ServerID</var> identification. This
48
constant, as well as the record containing the message which is sent between
49
client and server is defined in the <file>msgintf</file> unit.
52
The <file>dbugintf</file> unit relies on the <link id="SimpleIPC"/>
53
mechanism to communicate with the debug server, hence it works on all
54
platforms that have a functional version of that unit. It also uses
55
<var>TProcess</var> to start the debug server if needed, so the
56
<link id="process"/> unit should also be functional.
61
<!-- enumeration type Visibility: default -->
62
<element name="TDebugLevel">
63
<short>Level of the message.</short>
65
<var>TDebugLevel</var> indicates the severity level of the debug
66
message to be sent. By default, an informational message is sent.
69
<link id="SendDebugFmtEx"/>
70
<link id="SendDebugEx"/>
74
<!-- enumeration value Visibility: default -->
75
<element name="TDebugLevel.dlInformation">
76
<short>Informational message</short>
79
<!-- enumeration value Visibility: default -->
80
<element name="TDebugLevel.dlWarning">
81
<short>Warning message</short>
84
<!-- enumeration value Visibility: default -->
85
<element name="TDebugLevel.dlError">
86
<short>Error message</short>
89
<!-- procedure Visibility: default -->
90
<element name="SendBoolean">
91
<short>Send the value of a boolean variable</short>
93
<var>SendBoolean</var> is a simple wrapper around <link id="SendDebug"/>
94
which sends the name and value of a boolean value as an informational
101
<link id="SendDebug"/>
102
<link id="SendDateTime"/>
103
<link id="SendInteger"/>
104
<link id="SendPointer"/>
108
<!-- argument Visibility: default -->
109
<element name="SendBoolean.Identifier">
110
<short>Name of the boolean variable</short>
113
<!-- argument Visibility: default -->
114
<element name="SendBoolean.Value">
115
<short>Value of the boolean variable.</short>
118
<!-- procedure Visibility: default -->
119
<element name="SendDateTime">
120
<short>Send the value of a <var>TDateTime</var> variable.</short>
122
<var>SendDateTime</var> is a simple wrapper around <link id="SendDebug"/>
123
which sends the name and value of an integer value as an informational
124
message. The value is converted to a string using the <link
125
id="#rtl.sysutils.DateTimeToStr">DateTimeToStr</link> call.
131
<link id="SendDebug"/>
132
<link id="SendBoolean"/>
133
<link id="SendInteger"/>
134
<link id="SendPointer"/>
138
<!-- argument Visibility: default -->
139
<element name="SendDateTime.Identifier">
140
<short>Name of the <var>TDateTime</var> variable</short>
143
<!-- argument Visibility: default -->
144
<element name="SendDateTime.Value">
145
<short>The actual date/time</short>
148
<element name="SendInteger">
149
<short>Send the value of an integer variable.</short>
151
<var>SendInteger</var> is a simple wrapper around <link id="SendDebug"/>
152
which sends the name and value of an integer value as an informational
153
message. If <var>HexNotation</var> is <var>True</var>, then the value will be
154
displayed using hexadecimal notation.
160
<link id="SendDebug"/>
161
<link id="SendBoolean"/>
162
<link id="SendDateTime"/>
163
<link id="SendPointer"/>
167
<!-- argument Visibility: default -->
168
<element name="SendInteger.Identifier">
169
<short>Name of the integer variable</short>
172
<!-- argument Visibility: default -->
173
<element name="SendInteger.Value">
174
<short>The actual value</short>
177
<element name="SendInteger.HexNotation">
178
<short>Format integer using hexadecimal notation</short>
181
<element name="SendPointer">
182
<short>Send the value of a pointer variable.</short>
184
<var>SendInteger</var> is a simple wrapper around <link id="SendDebug"/>
185
which sends the name and value of a pointer value as an informational
186
message. The pointer value is displayed using hexadecimal notation.
192
<link id="SendDebug"/>
193
<link id="SendBoolean"/>
194
<link id="SendDateTime"/>
195
<link id="SendInteger"/>
199
<!-- argument Visibility: default -->
200
<element name="SendPointer.Identifier">
201
<short>Name of the pointer variable</short>
204
<!-- argument Visibility: default -->
205
<element name="SendPointer.Value">
206
<short>The actual pointer value</short>
209
<!-- procedure Visibility: default -->
210
<element name="SendDebugEx">
211
<short>Send debug message other than informational messages</short>
214
<var>SendDebugEx</var> allows to specify the debug level of the message
215
to be sent in <var>MType</var>. By default, <link id="SendDebug"/> uses
216
informational messages.
219
Other than that the function of <var>SendDebugEx</var> is equal to that of
227
<link id="SendDebug"/>
228
<link id="SendDebugFmt"/>
229
<link id="SendDebugFmtEx"/>
233
<!-- argument Visibility: default -->
234
<element name="SendDebugEx.Msg">
235
<short>Message to be sent</short>
238
<!-- argument Visibility: default -->
239
<element name="SendDebugEx.MType">
240
<short>Debug level of the message to be sent</short>
243
<!-- procedure Visibility: default -->
244
<element name="SendDebug">
245
<short>Send a message to the debug server.</short>
248
<var>SendDebug</var> sends the message <var>Msg</var> to the debug server as
249
an informational message (debug level <var>dlInformation</var>).
250
If no debug server is running, then an attempt will be made to start the
254
The binary that is started is called <file>debugserver</file> and should be somewhere
255
on the <var>PATH</var>. A sample binary which writes received messages to
256
standard output is included in the FCL, it is called <file>dbugsrv</file>.
257
This binary can be renamed to <file>debugserver</file> or can be started
258
before the program is started.
262
Errors are silently ignored, any exception messages are stored in <link id="SendError"/>.
265
<link id="SendDebugEx"/>
266
<link id="SendDebugFmt"/>
267
<link id="SendDebugFmtEx"/>
271
<!-- argument Visibility: default -->
272
<element name="SendDebug.Msg">
273
<short>The message to be sent to the server.</short>
276
<!-- procedure Visibility: default -->
277
<element name="SendMethodEnter">
278
<short>Send method enter message</short>
281
<var>SendMethodEnter</var> sends a "Entering <var>MethodName</var>" message
282
to the debug server. After that it increases the message indentation
283
(currently 2 characters). By sending a corresponding <link id="SendMethodExit"/>,
284
the indentation of messages can be decreased again.
287
By using the <var>SendMethodEnter</var> and <var>SendMethodExit</var>
288
methods at the beginning and end of a procedure/method,
289
it is possible to visually trace program execution.
296
<link id="SendDebug"/>
297
<link id="SendMethodExit"/>
298
<link id="SendSeparator"/>
302
<!-- argument Visibility: default -->
303
<element name="SendMethodEnter.MethodName">
304
<short>Name of the entered method</short>
307
<!-- procedure Visibility: default -->
308
<element name="SendMethodExit">
309
<short>Send method exit message </short>
312
<var>SendMethodExit</var> sends a "Exiting <var>MethodName</var>" message
313
to the debug server. After that it decreases the message indentation
314
(currently 2 characters). By sending a corresponding <link
315
id="SendMethodEnter"/>, the indentation of messages can be increased again.
318
By using the <var>SendMethodEnter</var> and <var>SendMethodExit</var>
319
methods at the beginning and end of a procedure/method,
320
it is possible to visually trace program execution.
323
Note that the indentation level will not be made negative.
330
<link id="SendDebug"/>
331
<link id="SendMethodEnter"/>
332
<link id="SendSeparator"/>
336
<!-- argument Visibility: default -->
337
<element name="SendMethodExit.MethodName">
338
<short>Name of the method that is entered</short>
341
<!-- procedure Visibility: default -->
342
<element name="SendSeparator">
343
<short>Send a separator message</short>
345
<var>SendSeparator</var> is a simple wrapper around <link id="SendDebug"/>
346
which sends a short horizontal line to the debug server. It can be used to
347
visually separate execution of blocks of code or blocks of values.
353
<link id="SendDebug"/>
354
<link id="SendMethodEnter"/>
355
<link id="SendMethodExit"/>
359
<!-- procedure Visibility: default -->
360
<element name="SendDebugFmt">
361
<short>Format and send a debug message</short>
363
<var>SendDebugFmt</var> is a utility routine which formats a message by
364
passing <var>Msg</var> and <var>Args</var> to <link
365
id="#rtl.sysutils.format">Format</link> and sends the result to the debug server
366
using <link id="SendDebug"/>. It exists mainly to avoid the
367
<var>Format</var> call in calling code.
373
<link id="SendDebug"/>
374
<link id="SendDebugEx"/>
375
<link id="SendDebugFmtEx"/>
376
<link id="#rtl.sysutils.format"/>
380
<!-- argument Visibility: default -->
381
<element name="SendDebugFmt.Msg">
382
<short>Template for message</short>
385
<!-- argument Visibility: default -->
386
<element name="SendDebugFmt.Args">
387
<short>Arguments to be inserted in template</short>
390
<!-- procedure Visibility: default -->
391
<element name="SendDebugFmtEx">
392
<short>Format and send message with alternate type</short>
394
<var>SendDebugFmtEx</var> is a utility routine which formats a message by
395
passing <var>Msg</var> and <var>Args</var> to <link
396
id="#rtl.sysutils.format">Format</link> and sends the result to the debug server
397
using <link id="SendDebugEx"/> with Debug level <var>MType</var>. It exists mainly to avoid the
398
<var>Format</var> call in calling code.
404
<link id="SendDebug"/>
405
<link id="SendDebugEx"/>
406
<link id="SendDebugFmt"/>
407
<link id="#rtl.sysutils.format"/>
411
<!-- argument Visibility: default -->
412
<element name="SendDebugFmtEx.Msg">
413
<short>Message template</short>
416
<!-- argument Visibility: default -->
417
<element name="SendDebugFmtEx.Args">
418
<short>Arguments to insert in template</short>
421
<!-- argument Visibility: default -->
422
<element name="SendDebugFmtEx.MType">
423
<short>Debug level of message</short>
426
<!-- function Visibility: default -->
427
<element name="StartDebugServer">
428
<short>Start the debug server</short>
431
<var>StartDebugServer</var> attempts to start the debug server. The process
432
started is called <file>debugserver</file> and should be located in the
436
Normally this function should not be called. The <link id="SendDebug"/> call
437
will attempt to start the server by itself if it is not yet running.
441
On error, <var>False</var> is returned.
444
<link id="SendDebug"/>
445
<link id="InitDebugClient"/>
449
<!-- function result Visibility: default -->
450
<element name="StartDebugServer.Result">
451
<short>True if started succesfully, false otherwise</short>
454
<!-- procedure Visibility: default -->
455
<element name="InitDebugClient">
456
<short>Initialize the debug client.</short>
459
<var>InitDebugClient</var> starts the debug server and then performs all
460
necessary initialization of the debug IPC communication channel.
463
Normally this function should not be called. The <link id="SendDebug"/> call
464
will initialize the debug client when it is first called.
471
<link id="SendDebug"/>
472
<link id="StartDebugServer"/>
476
<!-- constant Visibility: default -->
477
<element name="SendError">
478
<short>Last error in the debug system.</short>
480
Whenever a call encounteres an exception, the exception message is stored in
485
<!-- resource string Visibility: default -->
486
<element name="SProcessID">
487
<short>String used when sending identification message to the server.</short>
490
<!-- resource string Visibility: default -->
491
<element name="SEntering">
492
<short>String used when sending method enter message.</short>
495
<!-- resource string Visibility: default -->
496
<element name="SExiting">
497
<short>String used when sending method exit message.</short>
500
<!-- resource string Visibility: default -->
501
<element name="SSeparator">
502
<short>String used when sending a separator line.</short>
505
</module> <!-- dbugintf -->
507
</fpdoc-descriptions>