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