Node:Goal Tests, Next:, Previous:Breakpoint Conditions, Up:Breakpoint Conditions



Tests Related to the Current Goal

The following tests give access to basic information about the current invocation.

inv(Inv)
The invocation number of the current goal is Inv.
depth(Depth)
The current execution depth is Depth.
goal(MGoal)
The module name expanded MGoal template matches the current goal. The unification required for matching is carried out.
pred(MFunc)
The module name expanded MFunc template matches the functor (M:F/N) of the current goal. The unification required for matching is carried out.
module(Module)
The current goal is invoked from module Module. For compiled calls to built-in predicates Module will always be prolog.
goal_private(GoalPriv)
The private information associated with the current goal is GoalPriv. This is initialized to an unbound variable at the Call port. It is strongly recommended that GoalPriv is used as an open ended list, see Storing User Information in the Backtrace.
last_port(LastPort)
LastPort is the last completed port of the invocation present on the backtrace. Practically, this is only useful when looking at past execution states. LastPort is exit(nondet) if the invocation has been exited, and call otherwise.
parent_inv(Inv)
The invocation number of the debugger-parent of the current goal is Inv.
ancestor(AncGoal,Inv)
The youngest debugger-ancestor of the current goal, which matches the module name expanded AncGoal template, is at invocation number Inv. The unification required for matching is carried out.

Notes:

The debugger-parent of a goal is the youngest ancestor of the goal present on the backtrace. This will differ from the ordinary parent if not all goals are traced, e.g. if the goal in question is reached in zip mode. A debugger-ancestor of a goal is any of its ancestors on the backtrace.

In the goal and ancestor tests above, there is a given module qualified goal template, say ModT:GoalT, and it is matched against a concrete goal term Mod:Goal in the execution state. This matching is carried out as follows:

  1. For the match to succeed, Goal and GoalT have to be unifiable and are unified.
  2. Mod and ModT are either unifiable (and are unified), or name such modules in which Goal has the same meaning, i.e. either one of Mod:Goal and ModT:Goal is an exported variant of the other, or both are imported from the same module.

The above matching rules also apply for predicate functors, in the pred condition.