Skip to content

Commit 6920545

Browse files
authored
A rough dump of how to debug idris2's workings. (#1464)
1 parent 1aefab3 commit 6920545

File tree

2 files changed

+107
-0
lines changed

2 files changed

+107
-0
lines changed

docs/source/reference/debugging.rst

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
**********************
2+
Debugging The Compiler
3+
**********************
4+
5+
Performance
6+
===========
7+
8+
The compiler has the ``--timing`` flag to dump timing information collected during operation.
9+
10+
The output documents, in reverse chronological order, the cumulative time taken for the operation (and sub operations) to complete.
11+
Sub levels are indicated by successive repetitions of ``+``.
12+
13+
14+
Logging
15+
=======
16+
17+
The compiler logs various categories of information during operation at various levels.
18+
19+
Log levels are characterised by two things:
20+
21+
+ a dot-separated path of ever finer topics of interest e.g. scope.let
22+
+ a natural number corresponding to the verbosity level e.g. 5
23+
24+
If the user asks for some logs by writing::
25+
26+
%logging "scope" 5
27+
28+
they will get all of the logs whose path starts with `scope` and whose
29+
verbosity level is less or equal to `5`. By combining different logging
30+
directives, users can request information about everything (with a low
31+
level of details) and at the same time focus on a particular subsystem
32+
they want to get a lot of information about. For instance:::
33+
34+
%logging 1
35+
%logging "scope.let" 10
36+
37+
will deliver basic information about the various phases the compiler goes
38+
through and deliver a lot of information about scope-checking let binders.
39+
40+
41+
You can set the logging level at the command line using::
42+
43+
--log <level>
44+
45+
and through the REPL using::
46+
47+
:log <string category> <level>
48+
49+
:logging <string category> <level>
50+
51+
The supported logging categories can be found using the command line flag::
52+
53+
--help logging
54+
55+
REPL Commands
56+
=============
57+
58+
To see more debug information from the REPL there are several options one can set.
59+
60+
.. csv-table:: Logging Categories
61+
:header: "command", "description"
62+
:widths: 20, 20
63+
64+
``:di <name>``, show debugging information for a name
65+
``:set showimplicits``, show values of implicit arguments
66+
67+
Compiler Flags
68+
==============
69+
70+
There are several 'hidden' compiler flags that can help expose Idris' inner workings.
71+
72+
.. csv-table:: Logging Categories
73+
:header: "command", "description"
74+
:widths: 20, 20
75+
76+
``--dumpcases <file>``, dump case trees to the given file
77+
``--dumplifted <file>``, dump lambda lifted trees to the given file
78+
``--dumpanf <file>``, dump ANF to the given file
79+
``--dumpvmcode <file>``, dump VM Code to the given file
80+
``--debug-elab-check``, do more elaborator checks (currently conversion in LinearCheck)
81+
82+
83+
Output Formats
84+
==============
85+
86+
Debug Output
87+
------------
88+
89+
Calling ``:di <name>`` dumps debugging information about the selected term.
90+
Specifically dumped are:
91+
92+
.. csv-table:: Debugging Information
93+
:header: "topic", "description"
94+
:widths: 20, 20
95+
96+
Full Name(s), The fully qualified name of the term.
97+
Multiplicity, The terms multiplicity.
98+
Erasable Arguments, Things that are erased.
99+
Detaggable argument types,
100+
Specialised arguments,
101+
Inferrable arguments,
102+
Compiled version,
103+
Compile time linked terms,
104+
Runtime linked terms,
105+
Flags,
106+
Size change graph,

docs/source/reference/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ This is a placeholder, to get set up with readthedocs.
2222
literate
2323
overloadedlit
2424
builtins
25+
debugging

0 commit comments

Comments
 (0)