# Break\_hook/7

**URL:** <https://swi-prolog.discourse.group/t/break-hook-7/9817>\
**Category:** General\
**Tags:** bug\
**Created:** [September 10, 2026, 5:22am UTC](https://swi-prolog.discourse.group/t/break-hook-7/9817 "2026-09-10T05:22:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike.elston](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mike.elston/32/3691_2.png) [@mike.elston](https://swi-prolog.discourse.group/u/mike.elston)\
**Post date:** [September 10, 2026, 5:22am UTC](https://swi-prolog.discourse.group/t/break-hook-7/9817/1 "2026-09-10T05:22:05Z")

</div>

Playing around with breakpoints I added this hook definition and test code:

```prolog
prolog:break_hook(Clause, PC, FR, BFR, Expression, Debug, Action) :-
    writeln(user_error, break_hook(Clause, PC, FR, BFR, Expression, Debug)),
    Action = continue.

test :-
    writeln(egg).

```

I added a break point with Ctrl-c b:

 ![image](https://global.discourse-cdn.com/free1/uploads/swiprolog/original/2X/6/6a5f347463a174194c42be3031aa16800b9290b2.png)

I expected the break\_hook to write the break point context to user\_error but it brought up the graphical tracer and waited for input. Thinking it might just be graphical tracer I turned it off, but the result was the same.

 ![image](https://global.discourse-cdn.com/free1/uploads/swiprolog/original/2X/0/0fe4f385ff3d1f8a4df5515d0462150d221872e5.png)

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [September 10, 2026, 5:25pm UTC](https://swi-prolog.discourse.group/t/break-hook-7/9817/2 "2026-09-10T17:25:54Z")

</div>

Well, both the hook and breakpoint handling are defined in `library(prolog_breakpoints)`. If you want to get your own hook called you must load it before this library is loaded. Use

```
 ?- listing(break_hook, [source(true)]).

```

to see how it is defined and from where.
