[ ECLiPSe Event built-in.|Group Index| Full Index]

set_interrupt_flag(?Int_Id, +Mode)

Set the debugger mode Mode for the interrupt Int_Id

?Int_Id
Free variable, atom or integer.
+Mode
Atom.

Description

This predicate allows to debug interrupt handlers.

Mode may be trace, debug, notrace or nodebug (nodebug is a synonym for notrace). Int_Id may be a free variable, a interrupt number or a interrupt name (see current_interrupt/2 for correspondence between interrupt number and interrupt name).

When Int_Id is a free variable, all the interrupt handlers are set to the debugger mode Mode.

When an interrupt handler has its flag set to trace or debug, each time the handler is called the debugger will be switched on in this mode until the end of the handler.

The debugging of the handler is independent to the debugging of the interrupted execution. This means that the debugger does not need to be switched on in the interrupted execution to be able to trace the handler and that the invocation number and level of the handler always starts from 1 and 0 respectively. It also means that the current debugger mode of the interrupted execution and debugger mode of the interrupt handler does not influence each other.

Fail Conditions

None.

Resatisfiable

No.

Exceptions

(4) Instantiation fault
Mode is not instantiated.
(5) Type error
Mode is instantiated but not to an atom
(5) Type error
Int_Id is not a free variable, an integer or an atom
(6) Range error
Mode is instantiated to an atom but not to one of trace, debug, notrace or nodebug.
(6) Range error
Int_Id is instantiated to an integer that does not correspond to a valid interrupt or to an atom that is not a interrupt name.

Examples


Success:
      [eclipse]: set_interrupt_handler(int, writeln/1).
      yes.
      [eclipse]: set_interrupt_flag(int, trace).
      yes.
      [user].
       p :- true, interrupt(2), true, fail.
       user        compiled 152 bytes in 0.00 seconds
      yes.
      [eclipse]: p. % debugger is off in the execution of p/0
      B (1) 0  CALL   writeln(2) (dbg)?- creep
      2
      B (1) 0  EXIT   writeln(2) (dbg)?- creep
      no.
      [eclipse]: spy fail.
      spypoint added to fail / 0.
      yes.
      Debugger switched on - leap mode
      [eclipse]: p.
      % debugger is in leap mode in the execution of p/0
      % debugger is in creep mode in the handler
      B (1) 0  CALL   writeln(2) (dbg)?- creep
      2
      B (1) 0  EXIT   writeln(2) (dbg)?- creep
      % debugger is back in leap mode
      B+(5) 1  CALL   fail (dbg)?- creep
      B+(5) 1  FAIL   fail (dbg)?- creep
        (1) 0  FAIL   p (dbg)?- creep
      no.

Error:
      set_interrupt_flag(2, M).         (Error 4).
      set_interrupt_flag(2, "trace").   (Error 5).
      set_interrupt_flag("int", trace). (Error 5).
      set_interrupt_flag(int, skip).    (Error 6).
      set_interrupt_flag(123, trace).   (Error 6).


See Also

current_interrupt / 2, debug / 0, trace / 0