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