summaryrefslogtreecommitdiff
path: root/_sources/debugging/index.rst.txt
blob: 4e808962f2263f385a93b4415b7e41f4be10fd8a (plain)
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
44
45
46
47
48
49
50
51
52
53
54
.. _debugging:

Debugging
=========

Sometimes for debugging need to build accel-ppp with additional flags:

``-DCMAKE_BUILD_TYPE=Debug`` - Include debug information to accel-pppd binary

``-DCMAKE_C_FLAGS='-g -O0'`` - Enable optimization flags

``-DMEMDEBUG=TRUE`` - Set this flag if you want to debug memleak

Allow create core dump files without size limiting, edit /etc/security/limits.conf and add

.. code-block:: sh
  
  *  soft  core  unlimited

Or run ``ulimit -c unlimited`` for apply immediately

Edit ``/etc/sysctl.conf`` to define core dump file name and location, add

.. code-block:: sh
  
  kernel.core_uses_pid = 1
  kernel.core_pattern = /root/core-%e-%p

And apply ``sysctl -p``

If accel-ppp runs as systemd service to allow create coredumps it is necessary to add ``DefaultLimitCORE=infinity`` to ``/etc/systemd/system.conf`` and run ``systemctl daemon-reexec`` to activate new params.

Recommended: to create a self-checking program with predefined mistake. Create ``test.c`` with the following content

.. code-block:: sh
  
  int main() {
    *(char *)0 = 0;
    return 0;
  }

Compile this program ``gcc test.c`` and run ``./a.out``

If core files appear in ``/root`` directory and in ``dmesg`` exist output ``a.out[xxxx]: segfault at ...`` then all done properly.

**Run accel-ppp in GDB (GNU Debugger)**

If you want to run accel-ppp in GDB, necessary disable logratation for accel-ppp log files.

.. code-block:: sh
  
  gdb -ex=run  --args accel-pppd -c /etc/accel-ppp.conf -p /var/run/accel-ppp.pid