]> git.proxmox.com Git - ceph.git/blob - ceph/doc/dev/developer_guide/debugging-gdb.rst
update ceph source to reef 18.1.2
[ceph.git] / ceph / doc / dev / developer_guide / debugging-gdb.rst
1 GDB - The GNU Project Debugger
2 ==============================
3
4 `The GNU Project Debugger (GDB) <https://www.sourceware.org/gdb>`_ is
5 a powerful tool that allows you to analyze the execution flow
6 of a process.
7 GDB can help to find bugs, uncover crash errors or track the
8 source code during execution of a development cluster.
9 It can also be used to debug Teuthology test runs.
10
11 GET STARTED WITH GDB
12 --------------------
13
14 Basic usage with examples can be found `here. <https://geeksforgeeks.org/gdb-command-in-linux-with-examples>`_
15 GDB can be attached to a running process. For instance, after deploying a
16 development cluster, the process number (PID) of a ``ceph-osd`` daemon can be found in::
17
18 $ cd build
19 $ cat out/osd.0.pid
20
21 Attaching gdb to the process::
22
23 $ gdb ./bin/ceph-osd -p <pid>
24
25 .. note::
26 It is recommended to compile without any optimizations (``-O0`` gcc flag)
27 in order to avoid elimination of intermediate values.
28
29 Stopping for breakpoints while debugging may cause timeouts, so the following
30 configuration options are suggested::
31
32 [osd]
33 osd_op_thread_timeout = 1500
34 osd_op_thread_suicide_timeout = 1500
35
36 Debugging Teuthology Tests
37 ^^^^^^^^^^^^^^^^^^^^^^^^^^
38
39 ``src/script/ceph-debug-docker.sh`` can be used to analyze Teuthology failures::
40
41 $ ./ceph-debug-docker.sh <branch-name>
42
43 Refer to the script header for more information.