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