xref: /linux/Documentation/process/debugging/index.rst (revision c34e9ab9a612ee8b18273398ef75c207b01f516d)
1.. SPDX-License-Identifier: GPL-2.0
2
3============================================
4Debugging advice for Linux Kernel developers
5============================================
6
7general guides
8--------------
9
10.. toctree::
11   :maxdepth: 1
12
13   driver_development_debugging_guide
14   userspace_debugging_guide
15
16.. only::  subproject and html
17
18subsystem specific guides
19-------------------------
20
21.. toctree::
22   :maxdepth: 1
23
24   media_specific_debugging_guide
25
26.. only::  subproject and html
27
28   Indices
29   =======
30
31   * :ref:`genindex`
32
33General debugging advice
34========================
35
36Depending on the issue, a different set of tools is available to track down the
37problem or even to realize whether there is one in the first place.
38
39As a first step you have to figure out what kind of issue you want to debug.
40Depending on the answer, your methodology and choice of tools may vary.
41
42Do I need to debug with limited access?
43---------------------------------------
44
45Do you have limited access to the machine or are you unable to stop the running
46execution?
47
48In this case your debugging capability depends on built-in debugging support of
49provided distribution kernel.
50The :doc:`/process/debugging/userspace_debugging_guide` provides a brief
51overview over a range of possible debugging tools in that situation. You can
52check the capability of your kernel, in most cases, by looking into config file
53within the /boot directory.
54
55Do I have root access to the system?
56------------------------------------
57
58Are you easily able to replace the module in question or to install a new
59kernel?
60
61In that case your range of available tools is a lot bigger, you can find the
62tools in the :doc:`/process/debugging/driver_development_debugging_guide`.
63
64Is timing a factor?
65-------------------
66
67It is important to understand if the problem you want to debug manifests itself
68consistently (i.e. given a set of inputs you always get the same, incorrect
69output), or inconsistently. If it manifests itself inconsistently, some timing
70factor might be at play. If inserting delays into the code does change the
71behavior, then quite likely timing is a factor.
72
73When timing does alter the outcome of the code execution using a simple
74printk() for debugging purposes may not work, a similar alternative is to use
75trace_printk() , which logs the debug messages to the trace file instead of the
76kernel log.
77
78**Copyright** ©2024 : Collabora
79