Skip to content

Commit e3a22b5

Browse files
Benjamin-PhilipJuliaLawall
authored andcommitted
Documentation: Coccinelle: document debug log handling
The current debug documentation does not mention that logs are printed to stdout unless DEBUG_FILE is set. It also doesn't mention that Coccinelle cannot overwrite debug files. Document this behaviour in the examples and reference it in the debugging section. Signed-off-by: Benjamin Philip <benjamin.philip495@gmail.com> Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
1 parent bb1c9cc commit e3a22b5

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

Documentation/dev-tools/coccinelle.rst

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,18 @@ To enable verbose messages set the V= variable, for example::
127127

128128
make coccicheck MODE=report V=1
129129

130+
By default, coccicheck will print debug logs to stdout and redirect stderr to
131+
/dev/null. This can make coccicheck output difficult to read and understand.
132+
Debug and error messages can instead be written to a debug file instead by
133+
setting the ``DEBUG_FILE`` variable::
134+
135+
make coccicheck MODE=report DEBUG_FILE="cocci.log"
136+
137+
Coccinelle cannot overwrite a debug file. Instead of repeatedly deleting a log
138+
file, you could include the datetime in the debug file name::
139+
140+
make coccicheck MODE=report DEBUG_FILE="cocci-$(date -Iseconds).log"
141+
130142
Coccinelle parallelization
131143
--------------------------
132144

@@ -208,11 +220,10 @@ include options matching the options used when we compile the kernel.
208220
You can learn what these options are by using V=1; you could then
209221
manually run Coccinelle with debug options added.
210222

211-
Alternatively you can debug running Coccinelle against SmPL patches
212-
by asking for stderr to be redirected to stderr. By default stderr
213-
is redirected to /dev/null; if you'd like to capture stderr you
214-
can specify the ``DEBUG_FILE="file.txt"`` option to coccicheck. For
215-
instance::
223+
An easier approach to debug running Coccinelle against SmPL patches is to ask
224+
coccicheck to redirect stderr to a debug file. As mentioned in the examples, by
225+
default stderr is redirected to /dev/null; if you'd like to capture stderr you
226+
can specify the ``DEBUG_FILE="file.txt"`` option to coccicheck. For instance::
216227

217228
rm -f cocci.err
218229
make coccicheck COCCI=scripts/coccinelle/free/kfree.cocci MODE=report DEBUG_FILE=cocci.err

0 commit comments

Comments
 (0)