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