Updated October 2025
xcall MIAMEX, MX_DEBUG, opcode, debuglevel {, traceminlvl, tracetags, traceoutput, traceprefix}.
MX_DEBUG (MIAMEX 144) queries or sets the DEBUG control variable, along with several options related to TRACE and DEBUG statements. It is mainly used by SET.LIT.
Parameters
0 (MXOP_GET) to retrieve the current value of the other parameters or 1 (MXOP_SET) to set them.
for opcode 0, returns the current value of the DEBUG control variable. For opcode 1, supplies the new value you want to set.
returns or sets the tracing prefix string (e.g. "$# $T $P"), depending on the op. Primarily used by SET.LIT.
returns or sets the minimum DEBUG value for activating TRACE and DEBUG statements by level. See Comments below for details.
tracetags (String)) [in/out]
returns or sets the current list (comma-delimited) of tags used to activate TRACE and DEBUG statements. See Comments for details.
traceoutput (String) [in/out]
returns or sets the output destination for TRACE and DEBUG statements. See DEBUG Settings for available options ($WIN, $TTY, ...)
traceprefix (String) [in/out]
returns or sets the current list of macros added to those hard-coded in any applicable TRACE and DEBUG statements. See Comments for details.
Comments
The DEBUG control variable is useful for embedding debugging code into applications that can be enabled or disabled without modifying the programs. Other ways to modify the variable are via the SET DEBUG command or by compiling with the /DEBUG compile switch. Ways to use the variable within a program include:
IF DEBUG THEN …
IF DEBUG > N THEN …
DEBUG.OPEN ! open System Messages window (if DEBUG variable set)
DEBUG.PRINT msg ! output msg to debug window (if DEBUG variable set)
DEBUG.PAUSE msg ! output msg and wait (if DEBUG variable set)
DEBUG.CLOSE ! close System Messages window (if DEBUG variable set)
TRACE.PRINT (level, tags) var-or-expr, ... ! output trace, subject to activation and prefix criteria
The general form of the TRACE.PRINT statement shown above includes two activation parameters (level and tags) which, along with the options managed by MX_DEBUG, determine whether the particular trace will be enabled at runtime. Specifically, the level value in the TRACE.PRINT statement must be less than or equal to the system DEBUG level (set by debuglevel) and greater than or equal to traceminlvl AND/OR one of the tracetags must match one of the tags; if tracetags starts with "+", then OR, else AND. If the statement gets enabled, any traceprefix macros (e.g. $#, $T, etc.) will be used to augment any hard-coded into the TRACE.PRINT statement.
See Also
| • | Event Tracing for more information on the System Messages window. |
History
2023 September, A-Shell 6.5.1744: add traceprefix parameter to support querying and setting global tracing prefix.