What does the `/` Find command do in Trace Mode?

When execution is paused on a leashed port, the docs here say you can use a command called “Find” (/) to:

Search for a port. After the‘/', the user can enter a line to specify the port to search for. This line consists of a set of letters indicating the port type, followed by an optional term, that should unify with the goal run by the port. If no term is specified it is taken as a variable, searching for any port of the specified type. If an atom is given, any goal whose functor has a name equal to that atom matches.

Where is it “searching”? Is it saying you can “search” for a port by continuing execution until you hit a port that matches the search you specify? Playing around with the feature didn’t help clarify it…

Yes. It continues execution until it encounters a matching port. Here is a little example using chat80,
looking for a call to country/_

?- trace, test_chat.
   Call: (11) chat80:test_chat ? /c country
Chat Natural Language Question Anwering Test

      Test |     Parse Semantics  Planning     Reply     TOTAL
   Call: (26) chat80:country(what, _26214, _26216, _26218, _26220, _26222, _26224, _26226, _26228, _26230) ? 

Instead of a call port you typically search for a fail port if you suspect some call to some predicate fails.

1 Like