dbJLink: Restore the jlink::debug flag, add debug and trace link types

This commit is contained in:
Andrew Johnson
2018-06-01 23:32:48 -05:00
parent f2ceb3bbbf
commit 8cdcaf5a87
4 changed files with 1082 additions and 0 deletions

View File

@@ -39,6 +39,7 @@ typedef struct jlink {
struct jlif *pif; /* Link methods */
struct jlink *parent; /* NULL for top-level links */
int parseDepth; /* Used by parser, unused afterwards */
unsigned debug:1; /* Set to request debug output to console */
/* Link types extend or embed this structure for private storage */
} jlink;

View File

@@ -14,5 +14,6 @@ DBD += links.dbd
dbRecStd_SRCS += lnkConst.c
dbRecStd_SRCS += lnkCalc.c
dbRecStd_SRCS += lnkState.c
dbRecStd_SRCS += lnkDebug.c
HTMLS += links.html

View File

@@ -15,6 +15,10 @@ The following additional link types are available in this release:
=item * L<dbState|/"dbState Link state">
=item * L<Debug|/"Debug Link debug">
=item * L<Trace|/"Trace Link trace">
=back
=head2 Using JSON Links
@@ -200,3 +204,35 @@ link is initialized if it doesn't already exist.
{state:"!simEnable"}
=cut
link(debug, lnkDebugIf)
variable(lnkDebug_debug, int)
=head3 Debug Link C<"debug">
The debug link type exists to enable debugging of other link types; it provides
no functionality itself other than to turn on the debug flag for the child link
that is its only parameter and pass all link operations down to that link.
=head4 Example
{debug:{state:"redBeam"}}
=cut
link(trace, lnkTraceIf)
=head3 Trace Link C<"trace">
The trace link type is a relative of the debug link type that also traces the
operation of its child link. At creation it turns on the debug flag of its child
link, then it prints the method arguments and return values of all link
operations before / after passing control down to the child link.
=head4 Example
{trace:{state:"redBeam"}}
=cut

1044
src/std/link/lnkDebug.c Normal file

File diff suppressed because it is too large Load Diff