From e6b2edc8027c40db4c12f8f081648cda4634f9f7 Mon Sep 17 00:00:00 2001
From: tmanevik The The For Windows users, For Windows users, The Argument The Crashdump Viewer is a WxWidgets based tool for browsing Erlang
crashdumps. See the For details about how to get started with the Crashdump Viewer, see the
+ This function starts the Starts the Crashdump Viewer GUI and
+ loads the specified crashdump. If If This function stops the Terminates the Crashdump Viewer and closes
all GUI windows. The easiest way to start Crashdump Viewer is to use the
- provided shell script named The easiest way to start Crashdump Viewer is to use
+ shell script Under Windows the batch file Under Windows, the batch file It is also possible to start the Crashdump Viewer from within
- an erlang node by calling The main window is opened when Crashdump Viewer has loaded a
- crashdump. It contains a title bar, a menu bar, a number of
- information panels and a status bar. The GUI main window is opened when Crashdump Viewer has loaded a
+ crashdump. It contains a title bar, a menu bar,
+ information tabs, and a status bar. The title bar shows the name of the currently loaded
crashdump. The menu bar contains a File menu and a Help
- menu. From the File menu a new crashdump can be loaded or the tool
- can be terminated. From the Help menu this user's guide and the
- chapter "How to interpret the Erlang crash dumps" from the user's
- guide for Erlang runtime system can be opened. "How to interpret
+ menu. From the File menu, a new crashdump can be loaded or
+ the tool can be terminated. From the Help menu, this User's Guide
+ and section "How to interpret the Erlang crash dumps" from the
+ ERTS application can be opened. "How to interpret
the Erlang crash dumps" describes the raw crashdumps in
- detail. Here you will also find information about each single
- field in the different information pages. This document can also
- be found directly in the OTP online documentation, via the Erlang
- runtime system user's guide.
The status bar at the bottom of the window will show a warning +
The status bar at the bottom of the window shows a warning if the currently loaded dump is truncated.
-The centre area of the main window contains the information - panels. Each panel displays information about a specific item or a - list of items. A panel is selected by clicking the title of the - tab.
+The center area of the main window contains the information + tabs. Each tab displays information about a specific item or a + list of items. Select a tab by clicking the tab title.
-From panels that display lists of items, for example the - Processes- or the Ports panel, a new window with further - information can be opened by double clicking a row or by right - clicking the row and selecting an item from the drop down +
From tabs displaying lists of items, for example, the + Processes tab or the Ports tab, a new window with + more information can be opened by double-clicking a row or by right- + clicking the row and selecting an item from the drop-down menu. The new window is called a detail window. Detail windows can - be opened for processes, ports, nodes and modules.
+ be opened for processes, ports, nodes, and modules. -The various information shown in a detail window might contain - links to processes or ports. Clicking one of these links will open +
The information shown in a detail window can contain + links to processes or ports. Clicking one of these links opens the detail window for the process or port in question. If the - process or port resided on a remote node, there will be no - information available. Clicking the link will then pop up a dialog - where you can choose whether to open the detail window for the - remote node or not. + process or port resides on a remote node, no + information is available. Clicking the link then displays a dialog + where you can choose to open the detail window for the + remote node.
-Some of the panels contain a left hand menu where sub items of - the panel's information area can be selected. Click on one of the - rows, and the information will be displayed in the right hand +
Some tabs contain a left-hand menu where subitems of + the information area can be selected. Click one of the + rows, and the information is displayed in the right-hand information area.
Each panel in the main window contains an information - page. If no information is found for an item, the page will be - empty. The reason for not finding any information about an item - can be that the dump is truncated, that it is a dump from an old - OTP release in which this item was not written or that the item - simply wasn't present in the system at the point of failure.
- -If the dump was truncated, a warning is displayed in the - status bar of the main window.
- -Even if some information about an item exists, there might be +
Each tab in the main window contains an information + page. If no information is found for an item, the page is + empty. The reason for not finding information about an item + can be the following:
+Even if some information about an item exists, there can be empty fields if the dump originates from an old OTP release.
-The value "-1" in any field means "unknown", and in most +
The value
The sections below describe some of the fields in the - different information panels. These are fields that do not exist +
The following sections describe some of the fields in the + information tabs. These are fields that do not exist in the raw crashdump, or in some way differ from the fields in - the raw crashdump. Details about other fields can be found in - the user's guide for the Erlang runtime system, in the chapter - "How to interpret the Erlang crash dumps". That chapter can also - be opened from the Help menu in the Crashdump Viewer's main - window, and there are also direct links from the specific - sections below to related information in "How to interpret the - Erlang crash dumps".
+ the raw crashdump. For details about other fields, see + the +The General information panel shows a short overview +
Tab General shows a short overview of the dump.
-The following fields are not described in the Erlang runtime - system user's guide:
+The following fields are not described in the ERTS + User's Guide:
Time of failure.
The total number of bytes allocated, equivalent to
+
The maximum number of bytes that has been allocated during + the lifetime of the originating node. This is only shown if + the Erlang runtime system is run instrumented.
If available in the dump, this is the total number of + atoms in the atom table. If the size of the atom table is + unavailable, the number of atoms visible in the dump is + displayed.
The number of processes visible in the dump.
The number of ETS tables visible in the dump.
The number of funs visible in the dump.
-
For details, see
+
The Processes panel shows a list of all processes - found in the crashdump, including some short information about - each process. By default the processes are sorted by their - pids. To sort by other topic, click the desired column - heading.
+Tab Processes shows a list of all processes + found in the crashdump, including brief information about + each process. By default, the processes are sorted by their + pids. To sort by another topic, click the desired column heading.
-The Memory column shows the 'Memory' field which was - added to crashdumps in R16B01. This is the total amount of memory +
Column Memory shows the 'Memory' field that was + added to crashdumps in Erlang/OTP R16B01. This is the total amount of memory used by the process. For crashdumps from earlier releases, this - column shows the 'Stack+heap' field. The value shown is always in - bytes.
+ column shows the 'Stack+heap' field. The value is always in bytes. -To view detailed information about a specific process, double - click the row in the list or right click the row and select - "Properties for <pid>".
+To view detailed information about a specific process, double- + click the row in the list, or right-click the row and select + Properties for <pid>.
-
-
For details, see
+
The Ports panel is similar to the Processes - panel, except it lists all ports found in the crashdump.
+Tab Ports is similar to the Processes + tab, except it lists all ports found in the crashdump.
-To see more details about a specific port, dobule click the row - or right click it and select "Properties for <port>". From - the right click menu you can also select "Properties for - <pid>", where <pid> is the process connected to the +
To view more details about a specific port, double-click the row
+ or right-click it and select Properties for <port>. From
+ the right-click menu, you can also select Properties for
+ <pid>, where
-
For details, see
+
The ETS Tables panel shows all ETS table information - found in the dump. The 'Id' is the same as the 'Table' field found - in the raw crashdump, and 'Memory' is the 'Words' field from the - raw crashdump translated into bytes. For tree tables there will - be no value in the 'Objects' field.
+Tab ETS Tables shows all ETS table information + found in the dump. Id is the same as the 'Table' field + in the raw crashdump. Memory is the 'Words' field from the + raw crashdump translated into bytes. For tree tables, there is + no value in the 'Objects' field.
-To open the detailed information page about the table, double - click or right click the row and select "Properties for - 'Identifier'".
+To open the detailed information page about the table, double- + click, or right-click the row and select Properties for + 'Identifier'.
To open the detailed information page about the owner process - of an ETS table, right click the row and select "Properties for - <pid>".
+ of an ETS table, right-click the row and select Properties for + <pid>. -
-
For details, see
+
The Timers panel shows all timer information found in +
Tab Timers shows all timer information found in the dump.
To open the detailed information page about the owner process - of a timer, right click the row and select "Properties for - <pid>".
+ of a timer, right-click the row and select Properties for + <pid>. -Double clicking a row in the Timers panel has no effect.
+Double-clicking a row in the Timers tab has no effect.
-
-
For details, see
+
The Schedulers panel shows all scheduler information +
Tab Schedulers shows all scheduler information found in the dump.
To open the detailed information page about the scheduler, - double click or right click the row and select "Properties for - 'Identifier'".
+ double-click, or right-click the row and select Properties for + 'Identifier'. -
-
For details, see
+
The Funs panel shows all Fun information found in the +
Tab Funs shows all fun information found in the dump.
To open the detailed information page about the module to which - the fun belongs, right click the row and select "Properties for - <mod>".
+ the fun belongs, right-click the row and select Properties for + <mod>. -Double clicking a row in the Funs panel has no effect.
+Double-clicking a row in the Funs tab has no effect.
-
-
For details, see
+
The Atoms panel lists all atoms found in the dump. By +
Tab Atoms lists all atoms found in the dump. By default the atoms are sorted in creation order from first to last. This is opposite of the raw crashdump where atoms are listed from last to first, meaning that if the dump was truncated in the - middle of the atom list only the last created atoms will be seen - in the Atoms panel.
+ middle of the atom list, only the last created atoms are visible + in the Atoms tab. -
-
For details, see
+
The Nodes panel shows a list of all external erlang - nodes which are referenced from the crashdump.
+Tab Nodes shows a list of all external Erlang + nodes that are referenced from the crashdump.
-If the page is empty it either means that the crashed node was - not distributed, that it was distributed but had no references to - other nodes or that the dump was truncated.
+If the page is empty, it means either of the following:
+If the node was distributed, all referenced nodes are - shown. The column named Connection type shows if the node - is visible, hidden or not connected. Visible nodes are alive nodes +
If the node is distributed, all referenced nodes are
+ visible. Column Connection type shows if the node
+ is visible, hidden, or not connected. Visible nodes are alive nodes
with a living connection to the originating node. Hidden nodes are
- the same as visible nodes, except they are started with the
-
To see more detailed information about a node, double click the - row or right click the row and select "Properties for node - <node>". From the right click menu you can also select - "Properties for <port>", to open the detailed information +
To see more detailed information about a node, double-click the + row, or right-click the row and select Properties for node + <node>. From the right-click menu, you can also select + Properties for <port>, to open the detailed information window for the controlling port.
-In the detailed information window for a node, any exsisting +
In the detailed information window for a node, any existing links and monitors between processes on the originating node and - the connected node are shown. Extra Info may contain - debug information (i.e. special information written if the - emulator is debug compiled) or error information.
+ the connected node are displayed. Extra Info can contain + debug information (that is, special information written if the + emulator is debug-compiled) or error information. -
-
For details, see
+
The Modules panel lists all modules that were loaded - on the originating node, and the current size of the code. If old - code exsits, the old size is also shown.
+Tab Modules lists all modules loaded + on the originating node, and the current code size. If old + code exists, the old size is also shown.
-To see detailed information about a specific module, double - click the row or right click it and select "Properties for - <mod>".
+To view detailed information about a specific module, double- + click the row, or right-click it and select Properties for + <mod>.
-
-
For details, see
+
The Memory panel shows memory and allocator - information. From the left hand menu you can select:
+Tab Memory shows memory and allocator + information. From the left-hand menu you can select the following:
-See
+
This page presents a summary of values from all allocators underneath it.
One entry per allocator. See
+
See
+
On the Internal Tables panel you can choose from the - left hand menu to see hash tables or index tables.
+On tab Internal Tables you can from the + left-hand menu select Hash Tables, Index Tables, + or Internal ETS Tables.
-
-
For details, see
+
Start Erlang Top with the provided scripts
+
Under Windows the batch file
Under Windows, batch file
The following configuration parameters exist for the
-
When executing the
The measured node.
+Value:
Mandatory
Cookie to use for the
Value:
Number of lines (processes) to display.
+Value:
Default:
Time interval (in seconds) between each update of + the display.
+Value:
Default:
If
Value:
Default:
Identifies what information to sort by.
+Value:
Default:
-Value:
-Default:
Value:
Default:
See the
For detalis about Erlang Top, see the
+
This function starts
Starts
This function starts
Starts
This function prints the help of
Displays the help of
This function is used to change the tool's configuration - parameters during runtime. The table above indicates the - allowed values for each parameter.
+Changes the configuration parameters of the tool during runtime.
+ Allowed parameters are
This function dumps the current display to a text file.
+Dumps the current display to a text file.
This function terminates
Terminates
Erlang Top,
Erlang Top,
Start Erlang Top in either of the following ways:
+The output from
The output from Erlang Top is as follows:
The header includes some system information:
- Load
- cpu is Runtime/Wallclock , i.e. the
- percentage of time where the node has been
- active, procs is the number of processes on the node,
- and runq is the number of processes that are ready to
- run.
- Memory
- - This is the memory allocated by the node in kilo bytes.
+ Load
+ -
+
+ cpu
+ Runtime/Wallclock , that is, the percentage of time
+ where the node has been active.
+ procs
+ The number of processes on the node.
+ runq
+ The number of processes that are ready to run.
+
+
+ Memory
+ The memory allocated by the node in kilobytes.
For each process the following information is presented:
- Time
- - This is the runtime for the process, i.e. the actual
- time the process has been scheduled in.
- Reds
- - This is the number of reductions that has been executed
- on the process
- Memory
- - This is the size of the process in bytes, obtained by a
- call to
process_info(Pid,memory) .
- MsgQ
- - This is the length of the message queue for the process.
+ Time
+ The runtime for the process, that is, the time that the process
+ has been scheduled in.
+ Reds
+ The number of reductions executed on the process.
+ Memory
+ The size of the process in bytes, obtained by a
+ call to process_info(Pid,memory) .
+ MsgQ
+ The length of the message queue for the process.
Time and Reds can be presented as
- accumulated values or as values since last update.
+ accumulated values or as values since the last update.
To start etop use the script
-
All configuration parameters can be set at start by adding
-
The parameters
A list of all valid configuration parameters can be found in
- the reference manual for
+% etop -node tiger@durin -setcookie mycookie -lines 15+ +
A list of all valid Erlang Top configuration parameters is available in
+ module
The parameters lines , interval , accumulate ,
+ and sort can be changed during runtime with function
+ etop:config/2 .
+
+ Example:
+ Change configuration parameter lines with text-based presentation.
+ Before the change, 10 lines are presented as follows:
+ ddll_server 0 582 3744 0 gen_server:loop/6
<127.5.0> application_controll 0 569 6756 0 gen_server:loop/6
======================================================================================== ]]>
- etop:config(lines,5).
-ok
+ Function etop:config/2 is called to change the number of showed
+ lines to 5:
+
+
+> etop:config(lines,5).
+ok
+
+ After the change, 5 lines are presented as follows:
========================================================================================
@@ -156,19 +173,20 @@ Pid Name or Initial Func Time Reds Memory MsgQ Current Func
<127.43.0> ddll_server 0 0 3744 0 gen_server:loop/6
========================================================================================
]]>
-
At any time, the current
At any time, the current Erlang Top display can be dumped to a
+ text file with function
+
Use the function
To stop Erlang Top, use function
+
The Observer application is a container including the following + tools for tracing and investigation of distributed systems:
+It is assumed that the reader is familiar with the Erlang + programming language.
+The observer is gui frontend containing various tools to
- inspect a system. It displays system information, application
- structures, process information, ets or mnesia tables and a frontend
- for tracing with
Observer is a graphical tool for observing the characteristics of
+ Erlang systems. The tool Observer displays system information, application
+ supervisor trees, process information, ETS tables, Mnesia tables,
+ and contains a front end for Erlang tracing with module
+
See the
For detalis about how to get started, see the
+
This function starts the
Starts the Observer GUI. + To stop the tool, close the window.
This chapter describes the OBSERVER application in - OTP, which provides tools for tracing and investigation of - distributed systems.
+The Observer application contains tools for tracing and + investigation of distributed systems.
There are currently no configuration parameters available for +
No configuration parameters are available for this application.
Observer, is a graphical tool for observing the characteristics of - erlang systems. Observer displays system information, application - supervisor trees, process information, ets or mnesia tables and contains - a frontend for erlang tracing. +
Observer is a graphical tool for observing the characteristics of + Erlang systems. Observer displays system information, application + supervisor trees, process information, ETS tables, Mnesia tables + and contains a front end for Erlang tracing.
Normally observer should be run from a standalone node to minimize - the impact of the system being observed. Example: +
Run Observer from a standalone node to minimize the impact of the + system being observed.
-
- > erl -sname observer -hidden -setcookie MyCookie -run observer
-
+ Example:
++% erl -sname observer -hidden -setcookie MyCookie -run observer
- Choose which node to observe via
In general the mouse buttons behaves as expected, use left click - to select objects, right click to pop up a menu with most used - choices and double click to bring up information about the - selected object. In most viewers with several columns you can change - sort order by left clicking on column header. +
The mouse buttons behave as expected. Use left-click + to select objects, right-click to get a menu with the most used + options, and double-click to display information about the + selected object. In most viewers with many columns, you can change + the sort order by left-clicking the column header.
The
Tab System displays general information about the active Erlang node + and its runtime system, such as build configuration, system capabilities, and + overall use statistics. +
+Tab Load Charts displays graphs of the current resource use on + the active Erlang node.
+Graph
Graph
The sum of all memory categories.
The sum of all process memory used.
The size used by the atom table.
The sum of all off-heap binaries allocated.
The memory allocated for code storage.
The used memory for all ETS tables.
Graph
Tab Memory Allocators displays detailed information of the carrier
+ size and current memory carriers. For details about memory carriers,
+ see module
+
Tab Applications presents application information. Select an application in the left list to display its supervisor - tree. -
-Opens a detailed information window on the selected process, + including the following:
+Shows the process information.
Shows the process messages.
Shows the process dictionary.
Shows the process current stack trace.
Shows the process state.
If enabled and available, shows the process SASL + log entries.
Adds the selected process identifier to tab Trace Overview + plus the node that the process resides on.
Adds the registered name of the process. This can be useful when tracing on + many nodes, as processes with that name are then traced on all traced nodes.
Adds the selected process and all processes below, + right of it, to tab Trace Overview.
Adds the selected process and all processes below, + right of it, to tab Trace Overview.
The
Tab Processes lists process information in columns. + For each process the following information is displayed:
The process identifier.
The number of reductions executed on the process. + This can be presented as accumulated values or as values since the last update.
The size of the process, in bytes, obtained by a
+ call to
The length of the message queue for the process.
Reds can be presented as accumulated values or as values since last update.
-Option Process info opens a detailed information window on the selected process, + including the following:
Shows the process information.
Shows the process messages.
Shows the process dictionary.
Shows the process current stack trace.
Shows the process state.
If enabled and available, shows the process SASL log entries.
Log requires application SASL to be started on the observed node,
+ with
Option Trace Processes adds the selected process identifiers to tab + Trace Overview plus the node that the processes reside on.
+Option Trace Named Processes adds the registered name of the processes. This can be + useful when tracing is done on many nodes, as processes with that name are then traced on + all traced nodes.
+The
Tab Table Viewer lists tables. By default, ETS tables + are displayed whereas unreadable private ETS tables and tables created by OTP + applications are not diplayed. Use menu View to view "system" + ETS tables, unreadable ETS tables, or Mnesia tables.
-Double click to view the content of the table. Select table and activate
In the table viewer you can regexp search for objects, edit and delete objects. +
Double-click to view the table content. To view table information, select the table + and activate menu View > Table information.
+You can use
The
When you want to trace function calls, you also need to setup
-
Tab Trace Overview handles tracing. Trace
+ by selecting the processes to be traced and how to trace
+ them. You can trace messages, function calls, and events, where
+ events are process-related events such as
To trace function calls, you also need to set up + trace patterns. Trace patterns select the function calls + to be traced. The number of traced function calls can be + further reduced with match specifications. Match + specifications can also be used to trigger more information in the trace messages.
-Trace patterns only applies to the traced processes.
Trace patterns only apply to the traced processes.
- Processes are added from the
- When adding processes, a window with trace options will pop up. The chosen options will - be set for the selected processes. - Process options can be changed by right clicking on a process. + When adding processes, a window with trace options is displayed. The chosen + options are set for the selected processes. + Process options can be changed by right-clicking a process.
- Processes added by process identifiers will add the nodes these
- processes resides on in the node list. Additional nodes can be added by the
- If function calls are traced, trace patterns must be added by
Use the
More information about tracing can be found in
Click button Start Trace to start the trace. + By default, trace output is written to a new window. Tracing is stopped + when the window is closed, or when clicking button Stop Trace. + Trace output can be changed with menu Options > Output. + The trace settings, including match specifications, can be saved to, + or loaded from, a file. +
+For details about tracing, see module
The Observer application contains tools for tracing - and investigation of distributed systems.
The Observer application contains tools for tracing - and investigation of distributed systems.
-The Trace Tool Builder
The Trace Tool Builder,
When using
When using
This function is a shortcut allowing to start a trace with one command. Each
- tuple in
-ttb:start_trace([Node, OtherNode],
-[{mod, foo, []}, {mod, bar, 2}],
-{all, call},
-[{file, File}, {handler,{fun myhandler/4, S}}])
- is equivalent to
-ttb:start_trace([Node, OtherNode], [{file, File}, {handler,{fun myhandler/4, S}}]),
+ tuple in Patterns is converted to a list, which in turn is passed to
+ ttb:tpl/2,3,4 .
+ The call:
+
+> ttb:start_trace([Node, OtherNode],
+ [{mod, foo, []}, {mod, bar, 2}],
+ {all, call},
+ [{file, File}, {handler,{fun myhandler/4, S}}]).
+ is equivalent to:
+
+> ttb:start_trace([Node, OtherNode],
+ [{file, File}, {handler,{fun myhandler/4, S}}]),
ttb:tpl(mod, foo, []),
ttb:tpl(mod, bar, 2, []),
-ttb:p(all, call)
+ttb:p(all, call).
This is equivalent to
Equivalent to
Handy shortcuts for common tracing settings.
This is equivalent to
Equivalent to
This function starts a file trace port on all given nodes - and also points the system tracer for sequential tracing to +
Starts a file trace port on all specified nodes + and points the system tracer for sequential tracing to the same port.
-The given
When tracing diskless nodes,
Options:
+The specified
Can be used if the size of the trace logs must be limited.
+ Default values are
+
When tracing diskless nodes,
The
Indicates if process
+ information is to be collected. If
The
The
The
Indicates that trace messages are to be printed on the
+ console as they are received by the tracing process. This implies
+ trace client
Shortcut for
Indicates that the trace is to be
automatically stopped after
The
Allows to enable overload
checking on the nodes under trace.
-
- When a node gets overloaded, it is not possible to issue
When a node gets overloaded, it is not possible to issue
The
-
- By default, autostart information is stored in a file called
+ different nodes).
Periodically flushes all file trace
+ port clients (see
+
Enables the autoresume feature.
+ When enabled, remote nodes try to reconnect to the controlling node
+ if they are restarted. The feature requires application Runtime_Tools
+ to be started (so it has to be present in the
By default, autostart information is stored in a file named
Stores the provided data for further retrieval. It is important to realize that the data storage used must not - be affected by the node crash.
Retrieves configuration stored with
Deletes configuration stored with
The
This function sets the given trace flags on the given
- processes. The
Sets the specified trace flags on the specified
+ processes. Flag
Please turn to the Reference manual for module
Processes can be given as registered names, globally - registered names or process identifiers. If a registered name - is given, the flags are set on processes with this name on all +
See the Reference Manual for module
+
Processes can be specified as registered names, globally + registered names, or process identifiers. If a registered name + is specified, the flags are set on processes with this name on all active nodes.
-Issuing this command starts the timer for this trace if
-
Issuing this command starts the timer for this trace if option
+
These functions should be used in combination with the
-
These functions are to be used with
+ trace flag
These functions are equivalent to the corresponding
- functions in
Sets trace patterns on global function calls.
Sets trace patterns on local and global function calls.
Clears trace patterns on local and global function + calls.
Clears trace patterns on local function calls.
Clears trace patterns on global function calls.
With
With
The shortcuts are as follows:
+All calls to
Executes the given entry or entries from the history
- list. History can be listed with
Executes the specified entry or entries from the history
+ list. To list history, use
Equivalent to
This function creates or extends a config file which can be +
Creates or extends a configuration file, which can be used for restoring a specific configuration later.
-The content of the config file can either be fetched from - the history or given directly as a list of +
The contents of the configuration file can either be fetched from
+ the history or specified directly as a list of
If the complete history is to be stored in the config file
-
If the complete history is to be stored in the configuration file,
+
If
If
Executes all entries in the given config file. Note that the history
- of the last trace is always available in the file named
-
Executes all entries in the specified configuration file.
+ Notice that the history of the last trace is always available
+ in file
Executes selected entries from the given config +
Executes selected entries from the specified configuration
file.
The content of a config file can be listed with +
To list the contents of a configuration file, use
Note that the history
- of the last trace is always available in the file named
-
Notice that the history of the last trace is always available
+ in file
Lists all entries in the given config file.
+Lists all entries in the specified configuration file.
The
File
Equivalent to
Equivalent to
A match specification can turn on or off sequential
- tracing. This function returns a match specification which
- turns on sequential tracing with the given
This match specification can be given as the last argument
- to
This match specification can be specified as the last argument
+ to
If
Please turn to the reference manual for the
-
The possible values for
For a description of the
The system tracer for sequential tracing is
automatically initiated by
Example of how to use the
-(tiger@durin)5> ttb:tracer().
+ An example of how to use function seq_trigger_ms/0,1 follows:
+
+(tiger@durin)5> ttb:tracer().
{ok,[tiger@durin]}
-(tiger@durin)6> ttb:p(all,call).
+(tiger@durin)6> ttb:p(all,call).
{ok,{[all],[call]}}
-(tiger@durin)7> ttb:tp(mod,func,ttb:seq_trigger_ms()).
+(tiger@durin)7> ttb:tp(mod,func,ttb:seq_trigger_ms()).
{ok,[{matched,1},{saved,1}]}
-(tiger@durin)8>
- Whenever
Whenever
Equivalent to
The
The
Options:
+Indicates that trace logs are not to be + collected after tracing is stopped.
Allows specification of the directory to fetch the data to. If the directory already exists, an - error is thrown. -
-The
The
Indicates the trace logs to be formatted after tracing + is stopped. All logs in the fetch directory are merged.
Indicates the return value
+ to be
The
Returns the
Example:
Same as
Equivalent to
Reads the given binary trace log(s). The logs are processed
- in the order of their timestamp as long as
Reads the specified binary trace log(s). The logs are processed
+ in the order of their time stamps as long as option
If
If
If
The state returned from each call of
The state returned from each call of
If
If
Wrap logs can be formatted one by one or all in one go. To
- format one of the wrap logs in a set, give the exact name of
- the file. To format the whole set of wrap logs, give the name
- with '*' instead of the wrap count. See examples in the
-
Wrap logs can be formatted one by one or all at once. To
+ format one of the wrap logs in a set, specify the exact file name.
+ To format the whole set of wrap logs, specify the name
+ with
The Trace Tool Builder is a base for building trace tools for
- single node or distributed erlang systems. It requires the
-
Trace Tool Builder is a base for building trace tools for + single node or distributed Erlang systems. It requires the + Runtime_Tools application to be available on the traced node.
-The main features of the Trace Tool Builder are:
+The following are the main features of Trace Tool Builder:
The intention of the Trace Tool Builder is to serve
- as a base for tailor made trace tools, but you may use it directly
- from the erlang shell (it may mimic
The intention of Trace Tool Builder is to serve
+ as a base for tailor-made trace tools, but it can also be used directly
+ from the Erlang shell (it can mimic
The
Module
To get started, the least you need to do is to
+ start a tracer with
+
When the tracing is completed, stop the tracer with
+
If you want to trace function calls (i.e. if you have the
-
Useful functions:
+Opens a trace port on each node to be traced. By default, + trace messages are written to binary files on remote nodes (the + binary trace log).
Specifies the processes to be traced. Trace flags specified + in this call specify what to trace on each process. This function can be + called many times if you like different trace flags to be set on different + processes.
If you want to trace function calls (that is, if you have
+ trace flag
Stops tracing on all nodes, deletes all trace patterns, and + flushes the trace port buffer.
Translates the binary trace logs into something readable.
+ By default,
If option
This small module is used in the example:
+The following small module is used in the subsequent example:
-module(m).
-export([f/0]).
@@ -114,25 +121,25 @@ f() ->
From ! {self(),Now}
end.
The following example shows the basic use of
+
(tiger@durin)47> %% First I spawn a process running my test function
-(tiger@durin)47> Pid = spawn(m,f,[]).
-<0.125.0>
+(tiger@durin)47> Pid = spawn(m,f,[]).
+<0.125.0>
(tiger@durin)48>
(tiger@durin)48> %% Then I start a tracer...
-(tiger@durin)48> ttb:tracer().
+(tiger@durin)48> ttb:tracer().
{ok,[tiger@durin]}
(tiger@durin)49>
(tiger@durin)49> %% and activate the new process for tracing
(tiger@durin)49> %% function calls and sent messages.
-(tiger@durin)49> ttb:p(Pid,[call,send]).
-{ok,[{<0.125.0>,[{matched,tiger@durin,1}]}]}
+(tiger@durin)49> ttb:p(Pid,[call,send]).
+{ok,[{<0.125.0>,[{matched,tiger@durin,1}]}]}
(tiger@durin)50>
(tiger@durin)50> %% Here I set a trace pattern on erlang:now/0
(tiger@durin)50> %% The trace pattern is a simple match spec
@@ -140,33 +147,33 @@ f() ->
(tiger@durin)50> %% traced. Refer to the reference_manual for
(tiger@durin)50> %% the full list of match spec shortcuts
(tiger@durin)50> %% available.
-(tiger@durin)51> ttb:tp(erlang,now,return).
+(tiger@durin)51> ttb:tp(erlang,now,return).
{ok,[{matched,tiger@durin,1},{saved,1}]}
(tiger@durin)52>
(tiger@durin)52> %% I run my test (i.e. send a message to
(tiger@durin)52> %% my new process)
-(tiger@durin)52> Pid ! self().
-<0.72.0>
+(tiger@durin)52> Pid ! self().
+<0.72.0>
(tiger@durin)53>
(tiger@durin)53> %% And then I have to stop ttb in order to flush
(tiger@durin)53> %% the trace port buffer
-(tiger@durin)53> ttb:stop([return, {fetch_dir, "fetch"}]).
+(tiger@durin)53> ttb:stop([return, {fetch_dir, "fetch"}]).
{stopped, "fetch"}
(tiger@durin)54>
(tiger@durin)54> %% Finally I format my trace log
-(tiger@durin)54> ttb:format("fetch").
-({<0.125.0>,{m,f,0},tiger@durin}) call erlang:now()
-({<0.125.0>,{m,f,0},tiger@durin}) returned from erlang:now/0 ->
+(tiger@durin)54> ttb:format("fetch").
+({<0.125.0>,{m,f,0},tiger@durin}) call erlang:now()
+({<0.125.0>,{m,f,0},tiger@durin}) returned from erlang:now/0 ->
{1031,133451,667611}
-({<0.125.0>,{m,f,0},tiger@durin}) <0.72.0> !
-{<0.125.0>,{1031,133451,667611}}
-ok ]]>
+({<0.125.0>,{m,f,0},tiger@durin}) <0.72.0> !
+{<0.125.0>,{1031,133451,667611}}
+ok
This small example shows a simple tool for "debug tracing", - i.e. tracing of function calls with return values.
+The following example shows a simple tool for "debug tracing", + that is, tracing of function calls with return values:
"Return value :~p~n~n",
[N,Ts,P,M,F,A,R]). ]]>
To distinguish trace logs produced with this tool from other
- logs, the
By using the
By using option
The
Trace flag
The Observer application might not always be available on the - node that shall be traced (in the following called the "traced - node"). It is still possible to run the Trace Tool Builder from + node to be traced (in the following called the "traced + node"). However, Trace Tool Builder can still be run from another node (in the following called the "trace control node") as - long as + long as the following is fulfilled:
If the Trace Tool Builder shall be used against a remote node, +
If Trace Tool Builder is to be used against a remote node,
it is highly recommended to start the trace control node as
hidden. This way it can connect to the traced node
- without the traced node "seeing" it, i.e. if the
-% erl -sname trace_control -hidden
+ without being "seen" by it, that is, if the +% erl -sname trace_control -hidden
If the traced node is diskless,
-(trace_control@durin)1> ttb:tracer(mynode@diskless,{file,{local,
-{wrap,"mytrace"}}}).
-{ok,[mynode@diskless]}
+ a trace control node with disk access, and option +(trace_control@durin)1> ttb:tracer(mynode@diskless, + {file,{local,{wrap,"mytrace"}}}). +{ok,[mynode@diskless]}
When setting up a trace, several features may be turned on:
+When setting up a trace, the following features can also be activated:
Sometimes, it may be helpful to enable trace for a
- given period of time (i.e. to monitor a system for 24 hours
- or half of a second). This may be done by issuing additional
-
It can sometimes be helpful to enable trace for a
+ specified period of time (for example, to monitor a system for 24 hours
+ or half a second). This can be done with option
+
-(tiger@durin)1>ttb:start_trace([node()],
- [{erlang, now,[]}],
- {all, call},
- [{timer, {5000, format}}]).
-
+ milliseconds using
+ The timer is started with
+
The following example shows how to set up a trace that is + automatically stopped and formatted after 5 seconds: +
+(tiger@durin)1> ttb:start_trace([node()], + [{erlang, now,[]}], + {all, call}, + [{timer, {5000, format}}]).+
Because of network and processing delays, the period + of tracing is approximate.
When tracing live systems, special care needs to be always taken
- not to overload a node with too heavy tracing.
When tracing live systems, always take special care to not
+ overload a node with too heavy tracing.
Overload protection activated on one node does not
affect other nodes, where the tracing continues as normal.
-
+ ttb:stop/0,1 fetches data from all clients, including everything
+ collected before the activation of overload protection.
+
+
+ It is not allowed to change trace details
+ (with ttb:p and ttb:tp/tpl... ) once overload
+ protection is activated in one of the traced nodes. This is to
+ avoid trace setup being inconsistent between nodes.
+
+ Module:Function provided with option overload must
+ handle three calls: init , check , and stop . init
+ and stop allow some setup and teardown required by
+ the check. An overload check module can look as follows:
+
-module(overload).
-export([check/1]).
@@ -362,33 +372,37 @@ check(check) ->
end;
check(stop) ->
get(pid) ! stop.
+
+ check is always called by the same process, so put and
+ get are possible.
It is possible that a node (probably a buggy one, hence traced)
- crashes. In order to automatically resume tracing on the node
- as soon as it gets back,
In order not to loose the data that the failing node stored
- up to the point of crash, the control node will try to fetch
- it before restarting trace. This must happen within the allowed
- time frame or is aborted (default is 10 seconds, can be customized with
-
Autostart feature requires additional data to be stored on +
A node can crash (probably a buggy one, hence traced).
+ Use
To not lose the data that the failing node stored
+ up to the point of crash, the control node tries to fetch
+ it before restarting trace. This must occur within the allowed
+ time frame, otherwise it is aborted (default is 10 seconds, but it
+ can be changed with
The autostart feature requires more data to be stored on
traced nodes. By default, the data is stored automatically
- to the file called "ttb_autostart.bin" in the traced node's cwd.
- Users may decide to change this behaviour (i.e. on diskless
+ to the file named "ttb_autostart.bin" in the currect working directory
+ (cwd) of the traced node.
+ Users can change this behaviour (that is, on diskless
nodes) by specifying their own module to handle autostart data
storage and retrieval (
-module(ttb_autostart).
-export([read_config/0,
@@ -407,54 +421,60 @@ read_config() ->
end.
write_config(Data) ->
- file:write_file(?AUTOSTART_FILENAME, term_to_binary(Data)).
-
- Remember that file trace ports buffer the data
+ file:write_file(?AUTOSTART_FILENAME, term_to_binary(Data)).
+
+ Remember that file trace ports buffer the data
by default. If the node crashes, trace messages are not
- flushed to the binary log. If the chance of failure is
- high, it might be a good idea to automatically flush
- the buffers every now and then. Passing
The
Option
The command
Command
In addition to the trace log file(s), a file with the extension
-
In addition to the trace log file(s), a file with extension
+
Except for the process information, everything in the trace
information file is passed on to the handler function when
- formatting. The
You can add information to the trace information file by
- calling
Information to the trace information file by
+ can be added by calling
+
Example:
If you want to limit the size of the trace logs, you can use
wrap logs. This works almost like a circular buffer. You can
specify the maximum number of binary logs and the maximum size of
- each log.
Note that the overall size of data generated by ttb may be greater
- than the wrap specification would suggest - if a traced node restarts
- and autoresume is enabled, old wrap log is always stored and
+ The overall size of data generated by
Wrap logs can be formatted one by one or all at once. See
Formatting can be done automatically when stopping
Formatting means to read a binary log and present it in a
readable format. You can use the default format handler in
The first argument to
The first argument to
The second argument to
A format handler is a fun taking four arguments. This fun will - be called for each trace message in the binary log(s). A simple - example which only prints each trace message could be like this:
+Specifies the destination to write the formatted text.
+ Default destination is
Specifies the format handler to use. If this option is
+ not specified, option
Indicates that the logs are not to be merged according to + time-stamp, but processed one file after another (this can be + a bit faster).
A format handler is a fun taking four arguments. This fun is + called for each trace message in the binary log(s). A simple + example that only prints each trace message can be as follows:
fun(Fd, Trace, _TraceInfo, State) ->
io:format(Fd, "Trace: ~p~n", [Trace]),
State
end.
- Here,
ttb:format("tiger@durin-ttb", [{handler, {{Mod,Fun}, initial_state}}])
^^^^^^^^^^^^^
- Another format handler could be used to calculate time spent by +
Another format handler can be used to calculate the time spent by the garbage collector:
fun(_Fd,{trace_ts,P,gc_start,_Info,StartTs},_TraceInfo,State) ->
@@ -541,111 +570,118 @@ fun(_Fd,{trace_ts,P,gc_start,_Info,StartTs},_TraceInfo,State) ->
io:format("GC in process ~w: ~w milliseconds~n", [P,Time]),
State -- [{P,StartTs}]
end
- A more refined version of this format handler is the function
-
A more refined version of this format handler is function
+
The actual trace message is passed as the second argument (
The trace message is passed as the second argument (
By giving the format handler
By giving the format handler
+
You may always decide not to format the whole trace data contained
- in the fetch directory, but analyze single files instead. In order
- to do so, a single file (or list of files) have to be passed as
- the first argument to
Wrap logs can be formatted one by one or all in one go. To - format one of the wrap logs in a set, give the exact name of the - file. To format the whole set of wrap logs, give the name with '*' - instead of the wrap count. An example: +
You can always decide not to format the whole trace data contained
+ in the fetch directory, but analyze single files instead. To do so,
+ a single file (or list of files) must be passed as the first argument
+ to
Wrap logs can be formatted one by one or all at once. To
+ format one of the wrap logs in a set, specify the exact file name.
+ To format the whole set of wrap logs, specify the name with
Example:
Start tracing:
-
-(tiger@durin)1> ttb:tracer(node(),{file,{wrap,"trace"}}).
+
+(tiger@durin)1> ttb:tracer(node(),{file,{wrap,"trace"}}).
{ok,[tiger@durin]}
-(tiger@durin)2> ttb:p(...)
-...
- This will give a set of binary logs, like:
+(tiger@durin)2> ttb:p(...) +... +This gives a set of binary logs, for example:
tiger@durin-trace.0.wrp
tiger@durin-trace.1.wrp
tiger@durin-trace.2.wrp
...
Format the whole set of logs:
-
-1> ttb:format("tiger@durin-trace.*.wrp").
+
+1> ttb:format("tiger@durin-trace.*.wrp").
....
ok
-2>
+2>
Format only the first log:
-
-1> ttb:format("tiger@durin-trace.0.wrp").
+
+1> ttb:format("tiger@durin-trace.0.wrp").
....
ok
-2>
+2>
To merge all wrap logs from two nodes:
-
-1> ttb:format(["tiger@durin-trace.*.wrp","lion@durin-trace.*.wrp"]).
+
+1> ttb:format(["tiger@durin-trace.*.wrp","lion@durin-trace.*.wrp"]).
....
ok
-2>
+2>
For detailed information about the Event Tracer, please turn
- to the User's Guide and Reference Manuals for the
For detailed information about the Event Tracer, see the
+
By giving the format handler
By giving the format handler
+
The
The
The rest of the filters will only show function calls and +
The remaining filters only show function calls and
function returns. All other trace message are discarded. To get
- the most out of these filters,
The same result can be obtained by using the
-1> dbg:fun2ms(fun(_) -> return_trace(),message(caller()) end).
-[{'_',[],[{return_trace},{message,{caller}}]}]
- This should however be done with care, since the
-
The same result can be obtained by using the flag
+1> dbg:fun2ms(fun(_) -> return_trace(),message(caller()) end). +[{'_',[],[{return_trace},{message,{caller}}]}]+
This must however be done with care, as function
+
The
The
The
In the next example, modules
In the following example, modules
-module(foo).
-export([start/0,go/0]).
@@ -673,8 +709,9 @@ go() ->
go ->
bar:f1(),
go()
- end.
-
+ end.
+
+
-module(bar).
-export([f1/0,f3/0]).
f1() ->
@@ -685,57 +722,56 @@ f2() ->
f3() ->
ok.
- Now let's set up the trace.
-
-(tiger@durin)1>%%First we retrieve the Pid to limit traced processes set
-(tiger@durin)1>Pid = foo:start().
-(tiger@durin)2>%%Now we set up tracing
-(tiger@durin)2>ttb:tracer().
-(tiger@durin)3>ttb:p(Pid, [call, return_to, procs, set_on_spawn]).
-(tiger@durin)4>ttb:tpl(bar, []).
-(tiger@durin)5>%%Invoke our test function and see output with et viewer
-(tiger@durin)5>Pid ! go.
-(tiger@durin)6>ttb:stop({format, {handler, ttb:get_et_handler()}}).
-
-
- This should render a result similar to the - following: +
Setting up the trace:
++(tiger@durin)1> %%First we retrieve the Pid to limit traced processes set +(tiger@durin)1> Pid = foo:start(). +(tiger@durin)2> %%Now we set up tracing +(tiger@durin)2> ttb:tracer(). +(tiger@durin)3> ttb:p(Pid, [call, return_to, procs, set_on_spawn]). +(tiger@durin)4> ttb:tpl(bar, []). +(tiger@durin)5> %%Invoke our test function and see output with et viewer +(tiger@durin)5> Pid ! go. +(tiger@durin)6> ttb:stop({format, {handler, ttb:get_et_handler()}}).+ +
This renders a result similar to the following:
-Note, that we can use
-(tiger@durin)1>Pid = foo:start().
-(tiger@durin)2>ttb:start_trace([node()],
- [{bar,[]}],
- {Pid, [call, return_to, procs, set_on_spawn]}
- {handler, ttb:get_et_handler()}).
-(tiger@durin)3>Pid ! go.
-(tiger@durin)4>ttb:stop(format).
-
+ Notice that function
+
+(tiger@durin)1> Pid = foo:start(). +(tiger@durin)2> ttb:start_trace([node()], + [{bar,[]}], + {Pid, [call, return_to, procs, set_on_spawn]} + {handler, ttb:get_et_handler()}). +(tiger@durin)3> Pid ! go. +(tiger@durin)4> ttb:stop(format).
By default
By default,
+
+
If the option
If option
For the tracing functionality,
For the tracing functionality,
+
Use
Use
+
The main purpose of the history buffer is the possibility to create configuration files. Any function stored in the history buffer can be written to a configuration file and used for - creating a specific configuration at any time with one single + creating a specific configuration at any time with a single function call.
A configuration file is created or extended with
-
You can write the complete content of the history buffer to a
- config file by calling
-
The complete content of the history buffer can be written to a
+ configuration file by calling
+
User defined entries can also be written to a config file by
- calling the function
-
User-defined entries can also be written to a configuration file
+ by calling function
+
Any existing file
See the content of the history buffer
- ttb:tracer().
+ Example:
+ See the content of the history buffer:
+
+(tiger@durin)191> ttb:tracer().
{ok,[tiger@durin]}
-(tiger@durin)192> ttb:p(self(),[garbage_collection,call]).
-{ok,{[<0.1244.0>],[garbage_collection,call]}}
-(tiger@durin)193> ttb:tp(ets,new,2,[]).
+(tiger@durin)192> ttb:p(self(),[garbage_collection,call]).
+{ok,{[<0.1244.0>],[garbage_collection,call]}}
+(tiger@durin)193> ttb:tp(ets,new,2,[]).
{ok,[{matched,1}]}
-(tiger@durin)194> ttb:list_history().
+(tiger@durin)194> ttb:list_history().
[{1,{ttb,tracer,[tiger@durin,[]]}},
- {2,{ttb,p,[<0.1244.0>,[garbage_collection,call]]}},
- {3,{ttb,tp,[ets,new,2,[]]}}] ]]>
+ {2,{ttb,p,[<0.1244.0>,[garbage_collection,call]]}},
+ {3,{ttb,tp,[ets,new,2,[]]}}]
Execute an entry from the history buffer:
- ttb:ctp(ets,new,2).
+
+(tiger@durin)195> ttb:ctp(ets,new,2).
{ok,[{matched,1}]}
-(tiger@durin)196> ttb:list_history().
+(tiger@durin)196> ttb:list_history().
[{1,{ttb,tracer,[tiger@durin,[]]}},
- {2,{ttb,p,[<0.1244.0>,[garbage_collection,call]]}},
+ {2,{ttb,p,[<0.1244.0>,[garbage_collection,call]]}},
{3,{ttb,tp,[ets,new,2,[]]}},
{4,{ttb,ctp,[ets,new,2]}}]
-(tiger@durin)197> ttb:run_history(3).
+(tiger@durin)197> ttb:run_history(3).
ttb:tp(ets,new,2,[]) ->
-{ok,[{matched,1}]} ]]>
+{ok,[{matched,1}]}
Write the content of the history buffer to a configuration file:
- ttb:write_config("myconfig",all).
+
+(tiger@durin)198> ttb:write_config("myconfig",all).
ok
-(tiger@durin)199> ttb:list_config("myconfig").
+(tiger@durin)199> ttb:list_config("myconfig").
[{1,{ttb,tracer,[tiger@durin,[]]}},
- {2,{ttb,p,[<0.1244.0>,[garbage_collection,call]]}},
+ {2,{ttb,p,[<0.1244.0>,[garbage_collection,call]]}},
{3,{ttb,tp,[ets,new,2,[]]}},
{4,{ttb,ctp,[ets,new,2]}},
- {5,{ttb,tp,[ets,new,2,[]]}}] ]]>
+ {5,{ttb,tp,[ets,new,2,[]]}}]
Extend an existing configuration:
- ttb:write_config("myconfig",[{ttb,tp,[ets,delete,1,[]]}],
-[append]).
+
+(tiger@durin)200> ttb:write_config("myconfig",[{ttb,tp,[ets,delete,1,[]]}],
+[append]).
ok
-(tiger@durin)201> ttb:list_config("myconfig").
+(tiger@durin)201> ttb:list_config("myconfig").
[{1,{ttb,tracer,[tiger@durin,[]]}},
- {2,{ttb,p,[<0.1244.0>,[garbage_collection,call]]}},
+ {2,{ttb,p,[<0.1244.0>,[garbage_collection,call]]}},
{3,{ttb,tp,[ets,new,2,[]]}},
{4,{ttb,ctp,[ets,new,2]}},
{5,{ttb,tp,[ets,new,2,[]]}},
- {6,{ttb,tp,[ets,delete,1,[]]}}] ]]>
+ {6,{ttb,tp,[ets,delete,1,[]]}}]
Go back to a previous configuration after stopping Trace Tool Builder:
- ttb:stop().
+
+(tiger@durin)202> ttb:stop().
ok
-(tiger@durin)203> ttb:run_config("myconfig").
+(tiger@durin)203> ttb:run_config("myconfig").
ttb:tracer(tiger@durin,[]) ->
{ok,[tiger@durin]}
-ttb:p(<0.1244.0>,[garbage_collection,call]) ->
-{ok,{[<0.1244.0>],[garbage_collection,call]}}
+ttb:p(<0.1244.0>,[garbage_collection,call]) ->
+{ok,{[<0.1244.0>],[garbage_collection,call]}}
ttb:tp(ets,new,2,[]) ->
{ok,[{matched,1}]}
@@ -866,133 +908,135 @@ ttb:tp(ets,new,2,[]) ->
ttb:tp(ets,delete,1,[]) ->
{ok,[{matched,1}]}
-ok ]]>
+ok
Write selected entries from the history buffer to a configuration file:
- ttb:list_history().
+
+(tiger@durin)204> ttb:list_history().
[{1,{ttb,tracer,[tiger@durin,[]]}},
- {2,{ttb,p,[<0.1244.0>,[garbage_collection,call]]}},
+ {2,{ttb,p,[<0.1244.0>,[garbage_collection,call]]}},
{3,{ttb,tp,[ets,new,2,[]]}},
{4,{ttb,ctp,[ets,new,2]}},
{5,{ttb,tp,[ets,new,2,[]]}},
{6,{ttb,tp,[ets,delete,1,[]]}}]
-(tiger@durin)205> ttb:write_config("myconfig",[1,2,3,6]).
+(tiger@durin)205> ttb:write_config("myconfig",[1,2,3,6]).
ok
-(tiger@durin)206> ttb:list_config("myconfig").
+(tiger@durin)206> ttb:list_config("myconfig").
[{1,{ttb,tracer,[tiger@durin,[]]}},
- {2,{ttb,p,[<0.1244.0>,[garbage_collection,call]]}},
+ {2,{ttb,p,[<0.1244.0>,[garbage_collection,call]]}},
{3,{ttb,tp,[ets,new,2,[]]}},
{4,{ttb,tp,[ets,delete,1,[]]}}]
-(tiger@durin)207> ]]>
- To learn what sequential tracing is and how it can be used,
- please turn to the reference manual for the
-
The support for sequential tracing provided by the Trace Tool - Builder includes
+The support for sequential tracing provided by Trace Tool + Builder includes the following:
Starting sequential tracing requires that a tracer has been
- started with the
Starting sequential tracing requires that a tracer is
+ started with function
In the following example, the function +
Example 1:
+In the following example, function
ttb:tracer().
+
+(tiger@durin)110> ttb:tracer().
{ok,[tiger@durin]}
-(tiger@durin)111> ttb:p(self(),call).
-{ok,{[<0.158.0>],[call]}}
-(tiger@durin)112> ttb:tp(dbg,get_tracer,0,ttb:seq_trigger_ms(send)).
+(tiger@durin)111> ttb:p(self(),call).
+{ok,{[<0.158.0>],[call]}}
+(tiger@durin)112> ttb:tp(dbg,get_tracer,0,ttb:seq_trigger_ms(send)).
{ok,[{matched,1},{saved,1}]}
-(tiger@durin)113> dbg:get_tracer(), seq_trace:reset_trace().
+(tiger@durin)113> dbg:get_tracer(), seq_trace:reset_trace().
true
-(tiger@durin)114> ttb:stop(format).
-({<0.158.0>,{shell,evaluator,3},tiger@durin}) call dbg:get_tracer()
-SeqTrace [0]: ({<0.158.0>,{shell,evaluator,3},tiger@durin})
-{<0.237.0>,dbg,tiger@durin} ! {<0.158.0>,{get_tracer,tiger@durin}}
+(tiger@durin)114> ttb:stop(format).
+({<0.158.0>,{shell,evaluator,3},tiger@durin}) call dbg:get_tracer()
+SeqTrace [0]: ({<0.158.0>,{shell,evaluator,3},tiger@durin})
+{<0.237.0>,dbg,tiger@durin} ! {<0.158.0>,{get_tracer,tiger@durin}}
[Serial: {0,1}]
-SeqTrace [0]: ({<0.237.0>,dbg,tiger@durin})
-{<0.158.0>,{shell,evaluator,3},tiger@durin} ! {dbg,{ok,#Port<0.222>}}
+SeqTrace [0]: ({<0.237.0>,dbg,tiger@durin})
+{<0.158.0>,{shell,evaluator,3},tiger@durin} ! {dbg,{ok,#Port<0.222>}}
[Serial: {1,2}]
ok
-(tiger@durin)116> ]]>
- Starting sequential tracing with a trigger is actually more +(tiger@durin)116> +
Example 2:
+Starting sequential tracing with a trigger is more useful if the trigger function is not called directly from the shell, but rather implicitly within a larger system. When calling a function from the shell, it is simpler to start - sequential tracing directly, e.g.
- ttb:tracer().
+ sequential tracing directly, for example, as follows:
+
+(tiger@durin)116> ttb:tracer().
{ok,[tiger@durin]}
-(tiger@durin)117> seq_trace:set_token(send,true), dbg:get_tracer(),
-seq_trace:reset_trace().
+(tiger@durin)117> seq_trace:set_token(send,true), dbg:get_tracer(),
+seq_trace:reset_trace().
true
-(tiger@durin)118> ttb:stop(format).
-SeqTrace [0]: ({<0.158.0>,{shell,evaluator,3},tiger@durin})
-{<0.246.0>,dbg,tiger@durin} ! {<0.158.0>,{get_tracer,tiger@durin}}
+(tiger@durin)118> ttb:stop(format).
+SeqTrace [0]: ({<0.158.0>,{shell,evaluator,3},tiger@durin})
+{<0.246.0>,dbg,tiger@durin} ! {<0.158.0>,{get_tracer,tiger@durin}}
[Serial: {0,1}]
-SeqTrace [0]: ({<0.246.0>,dbg,tiger@durin})
-{<0.158.0>,{shell,evaluator,3},tiger@durin} ! {dbg,{ok,#Port<0.229>}}
+SeqTrace [0]: ({<0.246.0>,dbg,tiger@durin})
+{<0.158.0>,{shell,evaluator,3},tiger@durin} ! {dbg,{ok,#Port<0.229>}}
[Serial: {1,2}]
ok
-(tiger@durin)120> ]]>
- In both examples above, the
In both previous examples,
All functions in the
All functions in module
The module
Module
Start calltrace on all processes and trace the specified
function(s). The format handler used is
-
Trace garbage collection on the specified process(es). The
+ format handler used is
Trace in-scheduling and out-scheduling on the specified process(es).
+ The format handler used is
Erlang Debugger for debugging and testing of Erlang programs.
Starts Debugger.
-If given a file name as argument, Debugger will try to load - its settings from this file. Refer to Debugger User's Guide - for more information about settings.
+If a filename is specified as argument, Debugger tries to load + its settings from this file. For details about settings, see + the User's Guide.
-If given
If
This function can be used to debug a single process.
- The module
Debugs a single process. The module
Debugger is a graphical user interface for the Erlang - interpreter, which can be used for debugging and testing of - Erlang programs. For example, breakpoints can be set, code can be - single stepped and variable values can be displayed and changed. -
+To use Debugger, the basic steps are as follows:
-The Erlang interpreter can also be accessed via the interface
- module
Step 1. Start Debugger by calling
+
Warning: Note that the Debugger at some point might - start tracing on the processes which execute the interpreted - code. This means that a conflict will occur if tracing by other - means is started on any of these processes.
-The
Step 2. Select Module > Interpret... in the + Monitor window.
-Start Debugger by calling
The
Initially there are normally no debugged processes. First, it
- must be specified which modules should be debugged, or
- interpreted as it is also called. This is done by
- choosing Module->Interpret... in the Monitor window and
- then selecting the appropriate modules from the
-
Step 3. Select the appropriate modules from the Interpret + Dialog window.
Only modules compiled with the option
Only modules compiled with option
When a module is interpreted, it can be viewed in a
-
Now the program that should be debugged can be started. This is - done the normal way from the Erlang shell. All processes executing - code in interpreted modules will be displayed in the Monitor - window. It is possible to attach to one of these - processes, by double-clicking it, or by selecting the process and - then choosing Process->Attach.
- -Attaching to a process will result in a
-
Step 4. In the Monitor window, select + Module > the module to be interpreted > View.
+ +The contents of the source file is displayed in the
+
Step 5. Set the
+
Step 6. Start the program to be debugged. This is done + the normal way from the Erlang shell.
+ +All processes executing code in interpreted modules are displayed + in the Monitor window.
+ +Step 7. To attach to one of these processes,
+ double-click it, or select the process and then choose
+ Process > Attach. Attaching to a process opens an
+
Step 8. From the Attach Process window, you can control + the process execution, inspect variable values, set breakpoints, + and so on.
Once the appropriate modules are interpreted, breakpoints can be set at relevant locations in the source code. Breakpoints are specified on a line basis. When a process reaches a breakpoint, - it stops and waits for commands (step, skip, continue,...) from - the user.
+ it stops and waits for commands (Step, Skip, + Continue ...) from the user.When a process reaches a breakpoint, only that process is - stopped. Other processes are not affected.
+ stopped. Other processes are not affected.Breakpoints are created and deleted using the Break menu of - the Monitor window, View Module window and Attach Process window. -
+Breakpoints are created and deleted using the Break menu of + either the Monitor window, View Module window, or Attach Process + window.
To have effect, a breakpoint must be set at an
- executable line, which is a line of code containing an
- executable expression such as a matching or a function call.
- A blank line or a line containing a comment, function head or
- pattern in a
To have an effect, a breakpoint must be set at an
+ executable line, which is a line of code containing an
+ executable expression such as a matching or a function call.
+ A blank line or a line containing a comment, function head, or
+ pattern in a
In the example below, lines number 2, 4, 6, 8 and 11 are - executable lines:
+In the following example, lines 2, 4, 6, 8, and 11 are + executable lines:
1: is_loaded(Module,Compiled) -> 2: case get_file(Module,Compiled) of @@ -141,17 +136,15 @@Status and Trigger Action A breakpoint can be either active or - inactive. Inactive breakpoints are ignored.
- -Each breakpoint has a trigger action which specifies - what should happen when a process has reached it (and stopped): -
--
- enable Breakpoint should remain active (default). -
-- disable Breakpoint should be made inactive. -
-- delete Breakpoint should be deleted.
+ inactive. Inactive breakpoints are ignored. + +Each breakpoint has a trigger action that specifies + what is to happen when a process has reached it (and stopped):
++
- Enable - Breakpoint is to remain active (default). +
+- Disable - Breakpoint is to be made inactive.
+- Delete - Breakpoint is to be deleted.
A line breakpoint is created at a certain line in a module.
Right-clicking the Module entry will open a popup menu from - which the appropriate module can be selected.
+Right-click the Module entry to open a popup menu from + which the appropriate module can be selected.
-A line breakpoint can also be created (and deleted) by - double-clicking the line when the module is displayed in - the View Module or Attach Process window.
+A line breakpoint can also be created (and deleted) by + double-clicking the line when the module is displayed in + the View Module window or Attach Process window.
A conditional breakpoint is created at a certain line in - the module, but a process reaching the breakpoint will stop - only if a given condition is true.
+ the module, but a process reaching the breakpoint stops + only if a specified condition is true.The condition is specified by the user as a module name
-
Right-clicking the Module entry will open a popup menu from - which the appropriate module can be selected.
+Right-click the Module entry to open a popup menu from + which the appropriate module can be selected.
-Example: A conditional breakpoint calling
-
Example:
+ +A conditional breakpoint calling
+
Extract from
-5. fac(0) -> 1; -6. fac(N) when N > 0, is_integer(N) -> N * fac(N-1).+5. fac(0) -> 1; +6. fac(N) when N > 0, is_integer(N) -> N * fac(N-1).
Definition of
@@ -228,18 +223,18 @@ c_break(Bindings) ->Function Breakpoints A function breakpoint is a set of line breakpoints, one at - the first line of each clause in the given function.
+ the first line of each clause in the specified function.- -The Function Break Dialog Window. +Function Break Dialog Window Right-clicking the Module entry will open a popup menu from - which the appropriate module can be selected.
+To open a popup menu from which the appropriate module can be + selected, right-click the Module entry.
-Clicking the Ok button (or 'Return' or 'Tab') when a module - name has been given, will bring up all functions of the module - in the listbox.
+To bring up all functions of the module in the listbox, + click the OK button (or press the Return + or Tab key) when a module name has been specified,.
The Erlang emulator keeps track of a stack trace, information about recent function calls. This information is - used, for example, if an error occurs:
+ used if an error occurs, for example:1> catch a+1. {'EXIT',{badarith,[{erlang,'+',[a,1],[]}, @@ -259,602 +254,597 @@ c_break(Bindings) -> {shell,eval_exprs,7,[{file,"shell.erl"},{line,629}]}, {shell,eval_loop,3,[{file,"shell.erl"},{line,614}]}]}}-
See the Erlang Reference Manual,
-
For details about the stack trace, see section
+
The Debugger emulates the stack trace by keeping track of recently +
Debugger emulates the stack trace by keeping track of recently called interpreted functions. (The real stack trace cannot be - used, as it shows which functions of the Debugger have been - called, rather than which interpreted functions).
+ used, as it shows which functions of Debugger have been + called, rather than which interpreted functions.)This information can be used to traverse the chain of function
- calls, using the 'Up' and 'Down' buttons of
-
By default, the Debugger only saves information about recursive +
By default, Debugger only saves information about recursive function calls, that is, function calls that have not yet returned - a value (option 'Stack On, No Tail').
+ a value (option Stack On, No Tail).Sometimes, however, it can be useful to save all calls, even - tail-recursive calls. That can be done with the 'Stack On, Tail' - option. Note that this option will consume more memory and slow - down execution of interpreted functions when there are many - tail-recursive calls. -
- -It is also possible to turn off the Debugger stack trace - facility ('Stack Off'). Note: If an error occurs, in this - case the stack trace will be empty.
- -See the section about
To turn off the Debugger stack trace facility, select option + Stack Off.
+ +If an error occurs, the stack trace becomes empty in this + case.
+For information about how to change the stack trace option, see
+ section
The Monitor window is the main window of Debugger and displays the + following:
-The Monitor window is the main window of Debugger and shows a - listbox containing the names of all interpreted modules - (double-clicking a module brings up the View Module window), - which options are selected, and information about all debugged - processes, that is all processes which have been/are executing - code in interpreted modules.
+A listbox containing the names of all interpreted + modules
+Double-clicking a module brings up the View Module window.
+Which options are selected
Information about all debugged processes, that is, all + processes that have been or are executing code in interpreted + modules
The Auto Attach buttons, Stack Trace label, Back Trace Size
- label, and Strings button show some options set, see
-
The Auto Attach boxes, Stack Trace label,
+ Back Trace Size label, and Strings box display
+ some options set. For details about these options, see section
+
The process identifier.
The first call to an interpreted function by this
- process. (
The registered name, if any. If a registered name does - not show up, it may be that the Debugger received - information about the process before the name had been - registered. Try selecting Edit->Refresh.
The registered name, if any. If a registered name is not + displayed, it can be that Debugger received information about + the process before the name was registered. Try selecting + Edit > Refresh.
The current status, one of the following:
The interpreted function call has returned a value, - and the process is no longer executing interpreted code. -
The interpreted function call has returned a value, and + the process is no longer executing interpreted code.
The process is running.
The process is waiting in a
The process is stopped at a breakpoint.
The process has terminated.
There is no connection to the node where - the process is located.
Additional information, if any. If the process is
- stopped at a breakpoint, the field contains information
- about the location
More information, if any. If the process is
+ stopped at a breakpoint, the field contains information
+ about the location
Try to load and restore Debugger settings from a file - previously saved using Save Settings..., see below. - Any errors are silently ignored. - Note: Settings saved by Erlang R16B01 or later - cannot be read by Erlang R16B or earlier.
+Tries to load and restore Debugger settings from a file + previously saved using Save Settings... (see below). + Any errors are silently ignored.
+Notice that settings saved by Erlang/OTP R16B01 or later + cannot be read by Erlang/OTP R16B or earlier.
Save Debugger settings to a file. The settings include - the set of interpreted files, breakpoints, and the selected - options. The settings can be restored in a later Debugger - session using Load Settings..., see above. - Any errors are silently ignored.
+Saves Debugger settings to a file. The settings include + the set of interpreted files, breakpoints, and the selected + options. The settings can be restored in a later Debugger + session using Load Settings... (see above). + Any errors are silently ignored.
Stop Debugger.
Stops Debugger.
Update information about debugged processes. Removes - information about all terminated processes from the window, - and also closes all Attach Process windows for terminated - processes.
Updates information about debugged processes. Information + about all terminated processes are removed from the window. All + Attach Process windows for terminated processes are closed.
Terminate all processes listed in the window using
-
Terminates all processes listed in the window using
+
Open the
Opens the
+
Stop interpreting all modules. Processes executing in - interpreted modules will terminate.
Stops interpreting all modules. Processes executing in + interpreted modules terminate.
For each interpreted module, a corresponding entry is added to - the Module menu, with the following submenu:
+ the Module menu, with the following submenu:Stop interpreting the selected module. Processes - executing in this module will terminate.
Stops interpreting the selected module. Processes + executing in this module terminate.
Open a
Opens a
+
The following menu items apply to the currently selected
- process, provided it is stopped at a breakpoint. See the chapter
- about the
The following menu items apply to the currently selected - process.
+ process:Attach to the process and open a
-
Attaches to the process and open an
+
Terminate the process using
Terminates the process using
The items in this menu are used to create and delete
- breakpoints.
- See the
The items in this menu are used to create and delete breakpoints.
+ For details, see section
+
Set a line breakpoint.
Sets a line breakpoint.
Set a conditional breakpoint.
Sets a conditional breakpoint.
Set a function breakpoint.
Sets a function breakpoint.
Enable all breakpoints.
Enables all breakpoints.
Disable all breakpoints.
Disables all breakpoints.
Remove all breakpoints.
Removes all breakpoints.
For each breakpoint, a corresponding entry is added to - the Break - menu, from which it is possible to disable/enable or delete - the breakpoint, and to change its trigger action.
+For each breakpoint, a corresponding entry is added to the + Break menu, from which it is possible to disable, enable, + or delete the breakpoint, and to change its trigger action.
Set which areas should be visible in
- an
Sets the areas to be visible in an
+
Set at which events a debugged process should be - automatically attached to. Affects existing debugged - processes.
-Sets the events a debugged process is to be attached + to automatically. Affects existing debugged processes.
+First Call - The first time a process calls + a function in an interpreted module.
On Exit - At process termination.
On Break - When a process reaches a + breakpoint.
Set stack trace option, see section
+ Sets the stack trace option, see section
-
Stack On, Tail - Saves information about all + current calls.
Stack On, No Tail - Saves information about current calls, discarding previous information when a tail - recursive call is made.
Stack Off - Does not save any information about + current calls.
Set which integer lists should be printed as strings. - Does not affect already existing debugged processes.
-Sets the integer lists to be printed as strings. + Does not affect existing debugged processes.
+Use range of +pc flag - Uses the printable
+ character range set by the
Set how many call frames should be fetched when - inspecting the call stack from the Attach Process window. - Does not affect already existing Attach Process windows.
+Sets how many call frames to be fetched when + inspecting the call stack from the Attach Process window. + Does not affect existing Attach Process windows.
Contains a menu item for each open Debugger window. Selecting - one of the items will raise the corresponding window.
+ one of the items raises the corresponding window.View the Debugger documentation. Currently this - function requires a web browser to be up and running.
Shows the Debugger documentation. This function requires a + web browser.
The interpret dialog module is used for selecting which modules
- to interpret. Initially, the window shows the modules (
The Interpret Modules window is used for selecting which modules
+ to interpret. Initially, the window displays the modules (
Interpretable modules are modules for which a BEAM file, compiled
- with the option
Interpretable modules are modules for which a
Modules, for which the above requirements are not fulfilled, are - not interpretable and are therefore displayed within parentheses. -
+Modules for which these requirements are not fulfilled are + not interpretable and are therefore displayed within parentheses.
-The
Option
An example of how to compile code with debug information using
-
-
+% erlc +debug_info module.erl+
An example of how to compile code with debug information from
- the Erlang shell:
-
+4> c(module, debug_info).+
Browse the file hierarchy and interpret the appropriate modules
- by selecting a module name and pressing Choose (or
- carriage return), or by double clicking the module name.
- Interpreted modules have the type
To browse the file hierarchy and interpret the appropriate modules,
+ either select a module name and click Choose (or
+ press carriage return), or double-click the module name.
+ Interpreted modules have the type
Pressing All will interpret all displayed modules in - the chosen directory.
+To interpret all displayed modules in the chosen directory, click + All.
-Pressing Done will close the window.
+To close the window, click Done.
When the Debugger is started in global mode (which is
- the default, see
-
When Debugger is started in global mode (which is the default, see
+
From an Attach Process window the user can interact with a +
From an Attach Process window, you can interact with a debugged process. One window is opened for each process that has - been attached to. Note that when attaching to a process, its - execution is automatically stopped. -
+ been attached to. Notice that when attaching to a process, its + execution is automatically stopped.The window is divided into five parts:
-The Code area, showing the code being executed. The code
- is indented and each line is prefixed with its line number.
- If the process execution is stopped, the current line is
- marked with -->. An existing break point at a line
- is marked with a stop symbol. In the example above,
- the execution has been stopped at line 6, before
- the execution of
Active breakpoints are shown in red, while inactive - breakpoints are shown in blue.
+The window is divided into the following five parts:
+The Code area, displaying the code being executed. The code
+ is indented and each line is prefixed with its line number.
+ If the process execution is stopped, the current line is
+ marked with
Active breakpoints are displayed in red and inactive + breakpoints in blue.
The Button area, with buttons for quick access to frequently + used functions in the Process menu.
The Evaluator area, where you can evaluate functions + within the context of the debugged process, if that + process execution is stopped.
The Bindings area, displaying all variables bindings. If you + click a variable name, the value is displayed in the Evaluator area. + Double-click a variable name to open a window where + the variable value can be edited. Notice however that pid, + reference, binary, or port values cannot be edited.
The Trace area, showing a trace output for the process. -
+ +The Trace area, which displays a trace output for the + process.
Function call, where
Function return value
.The message
The message
Waiting in a
Waiting in a
Also the back trace, a summary of the current function calls - on the stack, is displayed in the Trace area.
+The Trace area also displays Back Trace, a summary of the + current function calls on the stack.
It is configurable using the Options menu which areas should - be shown or hidden. By default, all areas except the Trace area - are shown.
+Using the Options menu, you can set which areas to be + displayed. By default, all areas except the Trace area are displayed.
Close this window and detach from the process.
+Closes this window and detach from the process.
Go to a specified line number.
Goes to a specified line number.
Search for a specified string.
Searches for a specified string.
Execute the current line of code, stepping into any
+ Executes the current code line, stepping into any
(interpreted) function calls. Execute the current line of code and stop at the next
+ Executes the current code line and stop at the next
line. Continue the execution. Continues the execution. Continue the execution until the current function
+ Continues the execution until the current function
returns. Skip the current line of code and stop at the next
+ Skips the current code line and stop at the next
line. If used on the last line in a function body,
- the function will return Simulate a timeout when executing a
+ Simulates a time-out when executing a
Stop the execution of a running process, that is, make
- the process stop as at a breakpoint. The command will take
+ Stops the execution of a running process, that is, make
+ the process stop at a breakpoint. The command takes
effect (visibly) the next time the process receives a
message. Make sure the current location of the execution is
+ Verifies that the current location of the execution is
visible in the code area. Terminate the process using Terminates the process using Inspect the message queue of the process. The queue is
- printed in the evaluator area. Inspects the message queue of the process. The queue is
+ displayed in the Evaluator area. Display the back trace of the process, a summary of
- the current function calls on the stack, in the trace area.
- Requires that the Trace area is visible and that the stack
- trace option is 'Stack On, Tail' or 'Stack On, No Tail'. Displays the back trace of the process, a summary of
+ the current function calls on the stack, in the Trace area.
+ Requires that the Trace area is visible and that the Stack
+ Trace option is Stack On, Tail or
+ Stack On, No Tail. Inspect the previous function call on the stack,
+ Inspects the previous function call on the stack,
showing the location and variable bindings. Inspect the next function call on the stack, showing
+ Inspects the next function call on the stack, showing
the location and variable bindings.
Set which areas should be visible. Does not affect - other Attach Process windows.
-Sets which areas are to be visible. Does not affect + other Attach Process windows.
Same as in
Same as in the
Same as in
Same as in the
Set how many call frames should be fetched when
+ Sets how many call frames are to be fetched when
inspecting the call stack. Does not affect other Attach
- Process windows.
The Break, Windows and Help menus look the same as in
- the Monitor window, see the chapter
-
The Break, Windows, and Help menus
+ are the same as in the
+
The View Module window shows the contents of an interpreted +
The View Module window displays the contents of an interpreted module and makes it possible to set breakpoints.
The source code is indented and each line is prefixed with its line number.
-Clicking a line will highlight it and select it to be the target - of the breakpoint functions available from the Break menu. - Doubleclicking a line will set a line breakpoint on that line. - Doubleclicking a line with an existing breakpoint will remove - the breakpoint.
+Clicking a line highlights it and selects it to be the target + of the breakpoint functions available from the Break menu. + To set a line breakpoint on a line, double-click it. + To remove the breakpoint, double-click the line with an existing + breakpoint.
Breakpoints are marked with a stop symbol.
The File and Edit menus look the same as in the Attach Process
- window, see the chapter
The File and Edit menus are the same as in the
+
The Break, Windows and Help menus look the same as in
- the Monitor window, see the chapter
-
The Break, Windows, and Help menus
+ are the same as in the
+
Execution of interpreted code is naturally slower than for - regularly compiled modules. Using the Debugger also increases + regularly compiled modules. Using Debugger also increases the number of processes in the system, as for each debugged process another process (the meta process) is created.
-It is also worth to keep in mind that programs with timers may +
It is also worth to keep in mind that programs with timers can behave differently when debugged. This is especially true when - stopping the execution of a process, for example at a - breakpoint. Timeouts can then occur in other processes that + stopping the execution of a process (for example, at a + breakpoint). Time-outs can then occur in other processes that continue execution as normal.
Code loading works almost as usual, except that interpreted modules are also stored in a database and debugged processes - uses only this stored code. Re-interpreting an interpreted - module will result in the new version being stored as well, but + use only this stored code. Reinterpreting an interpreted + module results in the new version being stored as well, but does not affect existing processes executing an older version of the code. This means that the code replacement mechanism of Erlang does not work for debugged processes.
@@ -888,22 +878,24 @@ c_break(Bindings) ->By using
By using
+
debugger:start(local | global)-
If no argument is provided, Debugger is started in global mode. -
+ +If no argument is provided, Debugger starts in global mode.
In local mode, code is interpreted only at the current node. In global mode, code is interpreted at all known nodes. Processes - at other nodes executing interpreted code will automatically be - shown in the Monitor window and can be attached to like any other + at other nodes executing interpreted code are automatically + displayed in the Monitor window and can be attached to like any other debugged process.
-It is possible, but definitely not recommended to start Debugger - in global mode on more than one node in a network, as they will - interfere with each other leading to inconsistent behaviour.
+It is possible, but definitely not recommended, to start Debugger + in global mode on more than one node in a network, as the nodes + interfere with each other, leading to inconsistent behavior.
The module
The
This module also provides facilities for displaying status information about interpreted processes and break points.
It is possible to attach to interpreted processes by giving the corresponding process identity only. By default, an attachment - window pops up. Processes at other Erlang nodes can be + window is displayed. Processes at other Erlang nodes can be attached manually or automatically.
-By preference, these functions can be included in the module
-
By preference, these functions can be included in module
+
Starts a new graphical monitor. This is the Monitor window, - the main window of the Debugger. All of the Debugger and + the main window of Debugger. All the Debugger and interpreter functionality is accessed from the Monitor window. - The Monitor window displays the status of all processes that - have been/are executing interpreted modules.
+ This window displays the status of all processes that + have been or are executing interpreted modules.Makes a printout of the current status of all interpreted - processes.
+Prints the current status of all interpreted processes.
Clears information about processes executing interpreted code - byt removing all information about terminated processes.
+ by removing all information about terminated processes.Sets when and how to automatically attach to a debugged - process, see +
Sets when and how to attach to a debugged process
+ automatically, see
Sets how to save call frames in the stack, see
-
Attaches to the debugged process
Attaches to the debugged process
Attaches to the debugged process
Same as
Creates breakpoints at the first line of every clause of
- the
Deletes all breakpoints.
Deletes the breakpoint located at
Deletes the breakpoint at
Deletes the breakpoints at the first line of every clause of
- the
Makes the breakpoint at
Makes the breakpoint at
Makes the breakpoint at
Makes the breakpoint at
The conditional test is performed by calling
Makes a printout of all existing breakpoints.
+Prints all existing breakpoints.
Makes a printout of all existing breakpoints in
-
Prints all existing breakpoints in
Returns the current version number of the interpreter. - The same as the version number of the Debugger application. -
+ Same as the version number of thePrints help text.
Refer to the Debugger User's Guide for information about - the Debugger.
-The Erlang interpreter provides mechanisms for breakpoints and
- stepwise execution of code. It is mainly intended to be used by
- the Debugger, see Debugger User's Guide and
-
From the shell, it is possible to:
-The following can be done from the shell:
+By attaching to a process executing interpreted code, it
is possible to examine variable bindings and order stepwise
execution. This is done by sending and receiving information
- to/from the process via a third process, called the meta process.
- It is possible to implement your own attached process. See
+ to/from the process through a third process, called the meta
+ process. You can implement your own attached process. See
The interpreter depends on the Kernel, STDLIB and GS - applications, which means modules belonging to any of these - applications are not allowed to be interpreted as it could lead +
The interpreter depends on the Kernel, STDLIB, and + GS applications. This means that modules belonging to any of + these applications are not allowed to be interpreted, as it could lead to a deadlock or emulator crash. This also applies to modules - belonging to the Debugger application itself.
+ belonging to the Debugger application.Breakpoints are specified on a line basis. When a process executing code in an interpreted module reaches a breakpoint, it - will stop. This means that that a breakpoint must be set at an - executable line, that is, a line of code containing an executable + stops. This means that a breakpoint must be set at an + executable line, that is, a code line containing an executable expression.
-A breakpoint have a status, a trigger action and may have a
- condition associated with it. The status is either active
- or inactive. An inactive breakpoint is ignored. When a
- breakpoint is reached, the trigger action specifies if
- the breakpoint should continue to be active (enable), if
- it should become inactive (disable), or if it should be
- removed (delete). A condition is a tuple
-
A breakpoint has the following:
+By default, a breakpoint is active, has trigger action
-
A module may be given by its module name (atom) or by its - file name. If given by its module name, the object code +
A module can be specified by its module name (atom) or + filename.
+ +If specified by its module name, the object code
If given by its file name, the file name may include a path
- and the
If specified by its filename, the filename can include a path
+ and the
The interpreter needs both the source code and the object - code, and the object code must include debug - information. That is, only modules compiled with the option +
The interpreter requires both the source code and the object
+ code. The object code must include debug
+ information, that is, only modules compiled with option
The functions returns
The argument may also be a list of modules/file names, in +
The argument can also be a list of modules or filenames, in
which case the function tries to interpret each module as
- specified above. The function then always returns
As for
As for
Returns the source code file name
Returns the source code filename
Checks if a module is possible to interpret. The module can
- be given by its module name
The function returns
The function returns
Note that the function can return
Checks if a module can be interpreted. The module can be
+ specified by its module name
The function returns
The function returns
No source code is found.
+ It is assumed that the source code and object code are located
+ either in the same directory, or in
No object code is found.
+ It is assumed that the source code and object code are located
+ either in the same directory, or in
The module has not been compiled with option
+
Notice that the function can return
Gets and sets when and how to automatically attach to a +
Gets and sets when and how to attach automatically to a
process executing code in interpreted modules.
When the specified event occurs, the function
-spawn(Module, Name, [Pid | Args]) -+spawn(Module, Name, [Pid | Args]) +
Gets and sets how to save call frames in the stack. Saving call frames makes it possible to inspect the call chain of a process, and is also used to emulate the stack trace if an - error (an exception of class error) occurs.
-Save information about all current calls, + that is, function calls that have not yet returned a value.
+Save information about current calls, but discard previous information when a tail recursive call - is made. This option consumes less memory and may be + is made. This option consumes less memory and can be necessary to use for processes with long lifetimes and many - tail recursive calls. This is the default.
Save no information about currentcalls.
Deletes the breakpoint located at
Deletes the breakpoint at
Creates a breakpoint at the first line of every clause of
- the
Deletes the breakpoints at the first line of every clause of
- the
Deletes all breakpoints, or all breakpoints in
Deletes all breakpoints, or all breakpoints in
Makes the breakpoint at
Makes the breakpoint at
Makes the breakpoint at
Makes the breakpoint at
Sets the conditional test of the breakpoint at
Gets all breakpoints, or all breakpoints in
Gets all breakpoints, or all breakpoints in
Gets information about all processes executing interpreted code.
-Clears information about processes executing interpreted code by removing all information about terminated processes.
@@ -513,13 +531,13 @@ spawn(Module, Name, [Pid | Args])Resume process execution for
Resumes process execution for
Debugger is a graphical user interface for the Erlang + interpreter, which can be used for debugging and testing of + Erlang programs. For example, breakpoints can be set, code can be + single-stepped and variable values can be displayed and changed. +
+ +The Erlang interpreter can also be accessed through the interface
+ module
Debugger might at some point + start tracing on the processes that execute the interpreted + code. This means that a conflict occurs if tracing by other + means is started on any of these processes.
+It is assumed that the reader is familiar with the Erlang + programming language.
+Modules to be debugged must include debug information,
+ for example,
Debugger is a graphical tool which can be used for - debugging and testing of Erlang programs. For example, breakpoints - can be set, code can be single stepped and variable values can be - displayed and changed.
-Debugger is a graphical tool which can be used for - debugging and testing of Erlang programs. For example, breakpoints - can be set, code can be single stepped and variable values can be - displayed and changed.
-