Conditionally execute one of two lists of commands depending on whether an expression evaluates to TRUE (non-zero) or FALSE (zero).
Syntax:
── J ─ expression ─┬───────────────────┬─┬────────────────┬─ ├────── cmd1 ───────┤ └── ; ─ cmd2 ──┬─┘ └─ " ── cmd1 ─┬─ " ─┘ │ │ └────────────┘ └── ; ──┘
Parameters:
expression
If cmd1 is omitted, control is returned to the debugging console when the expression is TRUE.
If cmd2 is omitted, control is returned to the debugging console when the expression is FALSE. cmd2 commands.
Results & Notes:
If the expression resolves to one of the following forms, it is considered to be FALSE false:
00:0 &0:0 %0 %%0
Any other resolution is regarded as TRUE.
The J command is primarily intended to be used with the BP and BR commands to enable conditional breakpoints to be defined.
Examples of this usage are:
------------------------------------------------------------------------------- BP #f:12d5 "J ax!=10t,g" BP #f:12d5 "J ax==10t;g" BP SchedNextRet "J wo(Tasknumber)==8,'.p*;.r';g" BP DOSOPEN "J wo(Tasknumber)==32,'da #(wo(ss:sp+20)):(wo(ss:sp+1e));g';g" -------------------------------------------------------------------------------
The first example shows a breakpoint set at address #f:12d5. When this breakpoint fires the J command tests the condition AX register not equal to decimal 10. If this is true, the G command is executed. Since no cmd2 is specified the J command returns control to the debugging console when the condition is false (AX equal to decimal 10).
The second example is has the same effect as the first but is implemented by testing the logically opposite condition.
The third example shows one method of stopping the system when a thread switch to a particular thread slot has just occurred. In this case the debugging console gains control when thread slot 8 is selected, whereupon .p* and .r are automatically executed. The breakpoint SchedNextRet is one of two exit points from the scheduler (_tkSchedNext). The other, SchedNextRet2 is taken when the same thread slot is selected for re-dispatch. The global variable Tasknumber contains the current and therefore out-going slot number on entry to the scheduler; and in-coming slot number on exit from the dispatcher.
Note:
The kernel calls one of the KMExitKmode routines before giving control to user code. During this kernel exit processing the Resched and ( TCB and PTDA) force flags are checked again and if set the scheduler/dispatcher sequence is invoked. It is possible therefore, that even though a thread is selected to run, and achieves run state, it is put back on the ready queue before being given any user processing time.
The fourth example illustrates a method of tracing resources that are opened by a specific thread slot (in this case slot 32) without giving control to the debugging console. DOSOPEN is the kernel's entry point for open processing. At this point words 0x0f and 0x10 contain the offset and selector that points to the resource name.