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