PCE version 4C hlp_buffer encodingfirst_fragment last_fragmenteditorsmodifiedundo_buffer_sizesyntax indent_tabs generationrequest_renumberfileOIxNtextC hlp_fragment text_buffernextpreviousstylelabelOIxRIC hlp_header text_buffernextpreviousstylelabelOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOI xRIOI xRIOI xRIOI xRIOI xRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOI xRIOI!xRInRI Nexamplen (RINboldn RINsectionn RINboldnI RINboldn?RINboldn7RINsectionnNRIN subsectionn\!RINboldnRINboldnRINboldnRINboldnRINboldnRINboldnkRINboldn[RINboldn8RINboldnRINboldnRINboldnRI NboldnRI NboldnRI NboldnmRI NboldndRI NboldnZRINboldn4RINboldn RINboldnRIN subsectionn6RINexamplenRIN subsectionn'RINsectionn nNtitleNmainRI!naI'Adefault_syntax_tableA class_defaultIIuCfileencodingnamepathkindstatusfilterbom newline_modeOI"xNoctetNC/home/janw/src/pl-devel/packages/xpce/prolog/lib/trace/pltracer.hlpdNbinaryNwritendNposix SWI-Prolog Debugger 1. Operation 1.1. Starting the tracer Using the tracer is fairly obvious. To trace a goal, simply do: ?- gtrace, goal. The gtrace/0 predicate loads the graphical debugger using the predicate guitracer/0 and starts the tracer like trace/0. Similar, gspy/1 can be used to load the guitracer and set a spy-point like spy/1. Note that PceEmacs can set spy and breakpoints for you using the commands from the Prolog menu. As break-points are only supported by the GUI tracer, setting a break-point automatically loads the GUI tracer. 1.2. Tracer commands There are two ways for entering commands: using the toolbar-buttons or using the keyboard from the trace-window. The key-bindings are very similar to the text-based tracer. They are listed below in the order of the buttons. i into (show unify port) Space, Return creep s skip f finish (run till exit or fail of selected goal) r retry n nodebug b break (runs prolog toplevel in debugged thread) B break (creates a new window with a new thread) a abort u, arrow-up select parent frame d, arrow-down select child frame l leap (goto next spy-point) + set spy point (prompts for predicate) v show variable details e edit Double clicking in the Bindings window will show the binding in a dedicated window, which is useful for analysing complicated terms. 1.3. Call stack and choicepoints The top-right window shows the call-stack as well as the active choice-points. The stack frames are staked top-to-bottom. Choicepoints can be found by following the arrows. The vertical position of an active choicepoint indicates the nesting level and is alligned with the call-stack. All frames shown in this diagram can be clicked to find the related source location. Using the 'u' command the user can inspect the calling context of active choicepoints. 2. Multi-threaded applications This graphical is especially useful when debugging multi-threaded aplications as it provides a window for each thread being debugged. Debug-mode, spy-points, etc. can be managed using the predicate tspy/1, tdebug/0, tnodebug/0, etc. Please check the reference manual. 3. Running in a separate thread The development tools can run in a separate thread. This has some advantages, notably that the editor remains responsive while you run a query. To achieve this, edit the Prolog customization file, which can be edited from PceEmacs using the menu Edit/Prolog preferences and ensure the following line is uncommented: :- set_prolog_flag(xpce_threaded, true).rIxx