Predicates controlling the interactive debugger

Author(s): A. Ciepielewski, Mats Carlsson, T. Chikayama, K. Shen, Daniel Cabeza, Manuel C. Rodriguez, Edison Mera, Jose F. Morales, Manuel Hermenegildo.

This library implements predicates which are normally used in the interactive top-level shell to debug programs. A subset of them are available in the embeddable debugger.

Usage and interface

  • Library usage:
    :- use_module(library(debugger)).

Documentation on exports

Usage:debug_module(Module)

To debug the predicates in a module that module needs to be marked for debugging and re-loaded to be compiled in debug mode. This predicate marks module Module for debugging. This has two effects: The debugger will mark the module so that when predicates in this module are called the debugger is entered. In addition, the module is marked specially so that when (re)loaded it will be (re)compiled in debug mode. It also marks the module as 'modified' so that (re)loading this file or a main file that uses this module will force it to acrually be recompiled. Note that in addition to marking it for debugging the module needs to be reloaded after marking it, for all this to occur. In other words, the proper sequence to debug module m is:

    ?- debug_module(m). % Mark module m for debugging. ?- use_module(m). % Load module m in debugging mode. ?- trace. % Turn debugger on in, e.g., tracing mode.

This allows selecting which parts of the program are being debugged at the module level. It also allows having some modules loaded compiled in debug mode and others in standard mode (faster).

  • The following properties should hold at call time:
    (basic_props:atm/1)Module is an atom.

Usage:debug_module_source(Module)

The debugger will take into acount module Module (assuming it is is loaded in source-level debug mode). When issuing this command at the toplevel shell, the compiler is instructed also to set to interpret the loading mode of files defining that module and also to mark it as 'modified' so that (re)loading this file or a main file that uses this module will force it to be reloaded for source-level debugging.

  • The following properties should hold at call time:
    (basic_props:atm/1)Module is an atom.

Usage:nodebug_module(Module)

Unmark module Module for debugging. The debugger will not enter debug mode for module Module. When issuing this command at the toplevel shell, the compiler is instructed also to set to compile the loading mode of the iles defining that module, i.e., the module will be compiled in standard mode if reloaded.

  • The following properties should hold at call time:
    (basic_props:atm/1)Module is an atom.

PREDICATEdebug/0

Usage:

Switches the debugger on. The interpreter will stop at all ports of procedure boxes of spied predicates.

    PREDICATEnodebug/0

    Usage:

    Switches the debugger off. If there are any spy-points set then they will be kept but disabled.

      PREDICATEtrace/0

      Usage:

      Start tracing, switching the debugger on if needed. The interpreter will stop at all leashed ports of procedure boxes of predicates either belonging to debugged modules or called from clauses of debugged modules. A message is printed at each stop point, expecting input from the user (write h to see the available options).

        PREDICATEnotrace/0

        Usage:

        Equivalent to nodebug/0.

          PREDICATEmaxdepth/1

          Usage:maxdepth(MaxDepth)

          Set maximum invocation depth in debugging to MaxDepth. Calls to compiled predicates are not included in the computation of the depth.

          • The following properties should hold at call time:
            (basic_props:int/1)MaxDepth is an integer.

          PREDICATEspy/1

          Usage:spy(PredSpec)

          Set spy-points on predicates belonging to debugged modules and which match PredSpec, switching the debugger on if needed. This predicate is defined as a prefix operator by the toplevel.

          • The following properties should hold at call time:
            (basic_props:sequence/2)PredSpec is a sequence of multpredspecs.

          PREDICATEnospy/1

          Usage:nospy(PredSpec)

          Remove spy-points on predicates belonging to debugged modules which match PredSpec. This predicate is defined as a prefix operator by the toplevel.

          • The following properties should hold at call time:
            (basic_props:sequence/2)PredSpec is a sequence of multpredspecs.

          PREDICATEnospyall/0

          Usage:

          Remove all spy-points.

            PREDICATEdebugging/0

            Usage:

            Display debugger state.

              PREDICATEleash/1

              Usage:leash(Ports)

              Leash on ports Ports, some of call, exit, redo, fail. By default, all ports are on leash.

              • The following properties should hold at call time:
                (basic_props:list/2)Ports is a list of ports.

              PREDICATEbreakpt/6

              Usage:breakpt(Pred,Src,Ln0,Ln1,Number,RealLine)

              Set a breakpoint in file Src between lines Ln0 and Ln1 at the literal corresponding to the Number'th occurence of (predicate) name Pred. The pair Ln0-Ln1 uniquely identifies a program clause and must correspond to the start and end line numbers for the clause. The rest of the arguments provide enough information to be able to locate the exact literal that the RealLine line refers to. This is normally not issued by users but rather by the emacs mode, which automatically computes the different argument after selecting a point in the source file.

              Usage:

              Prints out the location of all breakpoints. The location of the breakpoints is showed usual by referring to the source file, the lines between which the predicate can be found, the predicate name and the number of occurrence of the predicate name of the literal.

                PREDICATEnobreakpt/6

                Usage:nobreakpt(Pred,Src,Ln0,Ln1,Number,RealLine)

                Remove a breakpoint in file Src between lines Ln0 and Ln1 at the Number'th occurence of (predicate) name Pred (see breakpt/6). Also normally used from de emacs mode.

                PREDICATEnobreakall/0

                Usage:

                Remove all breakpoints.

                  No further documentation available for this predicate.

                  No further documentation available for this predicate.

                  No further documentation available for this predicate.

                  (UNDOC_REEXPORT)debugrtc/0
                  Imported from debugger_lib (see the corresponding documentation for details)

                  (UNDOC_REEXPORT)nodebugrtc/0
                  Imported from debugger_lib (see the corresponding documentation for details)

                  (UNDOC_REEXPORT)tracertc/0
                  Imported from debugger_lib (see the corresponding documentation for details)

                  Documentation on imports

                  This module has the following direct dependencies: