10.5 library(threadutil): Interactive thread utilities
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • Multithreaded applications
        • library(threadutil): Interactive thread utilities
          • threads/0
          • join_threads/0
          • with_stopped_threads/2
          • thread_has_console/0
          • attach_console/0
          • attach_console/1
          • tspy/1
          • tspy/2
          • tdebug/0
          • tdebug/1
          • tnodebug/0
          • tnodebug/1
          • tbacktrace/1
          • tbacktrace/2
          • tprofile/1
          • thread_alias/1
    • Packages
Availability::- use_module(library(threadutil)).(can be autoloaded)
Source[det]tdebug
[det]tdebug(+ThreadOrClass)
[det]tnodebug
[det]tnodebug(+ThreadOrClass)
Enable or disable a thread or group of threads for debugging using the graphical tracer. A group of threads is addressed based on the class property of a thread set by thread_create/3 or set_thread/2. This implies loading the graphical tracer and switching the thread to debug mode using debug/0. New threads created inherit their debug mode from the thread that created them.

Thread classes have been introduced in SWI-Prolog 10.0.2/10.1.5. This allows for more selective debugging as well as ensuring debugging works in newly created threads. For example, the HTTP server creates all its worker threads in the class http. Using query below, we reliable make sure spy points are trapped in HTTP handler threads, regardless of whether the worker existed or is lazily created and regardless of whether the user switched to nodebug mode while tracing a previous event (see debug_reset_from_class/0).

?- tdebug(http).