File: debugging-gdb.rst

package info (click to toggle)
ceph 18.2.8%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,186,356 kB
  • sloc: cpp: 6,282,106; ansic: 3,507,390; python: 375,284; asm: 216,381; java: 133,450; sh: 125,595; xml: 39,398; ruby: 32,026; makefile: 29,004; javascript: 23,994; cs: 18,980; perl: 9,709; sql: 7,833; lisp: 5,920; pascal: 3,109; ada: 1,681; yacc: 478; awk: 188; f90: 55; php: 1
file content (43 lines) | stat: -rw-r--r-- 1,394 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
GDB - The GNU Project Debugger
==============================

`The GNU Project Debugger (GDB) <https://www.sourceware.org/gdb>`_ is
a powerful tool that allows you to analyze the execution flow
of a process.
GDB can help to find bugs, uncover crash errors or track the
source code during execution of a development cluster.
It can also be used to debug Teuthology tests runs.

GET STARTED WITH GDB
--------------------

Basic usage with examples can be found `here. <https://geeksforgeeks.org/gdb-command-in-linux-with-examples>`_
GDB can be attached to a running process. For instance, after deploying a
development cluster, the process number (PID) of a ``ceph-osd`` daemon can be found in::

    $ cd build
    $ cat out/osd.0.pid

Attaching gdb to the process::

    $ gdb ./bin/ceph-osd -p <pid>

.. note::
    It is recommended to compile without any optimizations (``-O0`` gcc flag)
    in order to avoid elimintaion of intermediate values.

Stopping for breakpoints while debugging may cause timeouts, so the following
configuration options are suggested::

        [osd]
        osd_op_thread_timeout = 1500
        osd_op_thread_suicide_timeout = 1500

Debugging Teuthology Tests
^^^^^^^^^^^^^^^^^^^^^^^^^^

``src/script/ceph-debug-docker.sh`` can be used to analyze Teuthology failures::

    $ ./ceph-debug-docker.sh <branch-name>

Refer to the script header for more information.