xref: /aosp_15_r20/external/ltp/doc/developers/debugging.rst (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker.. SPDX-License-Identifier: GPL-2.0-or-later
2*49cdfc7eSAndroid Build Coastguard Worker
3*49cdfc7eSAndroid Build Coastguard WorkerDebugging
4*49cdfc7eSAndroid Build Coastguard Worker=========
5*49cdfc7eSAndroid Build Coastguard Worker
6*49cdfc7eSAndroid Build Coastguard WorkerThis section explains some tricks which can be used to debug test binaries.
7*49cdfc7eSAndroid Build Coastguard Worker
8*49cdfc7eSAndroid Build Coastguard WorkerDebug messages
9*49cdfc7eSAndroid Build Coastguard Worker--------------
10*49cdfc7eSAndroid Build Coastguard Worker
11*49cdfc7eSAndroid Build Coastguard WorkerThe LTP framework supports ``TDEBUG`` flag test debug messages. These
12*49cdfc7eSAndroid Build Coastguard Workermessages can be enabled using the ``-D`` parameter or setting ``LTP_ENABLE_DEBUG=1``
13*49cdfc7eSAndroid Build Coastguard Workerenvironment variable (see :doc:`../users/setup_tests`).
14*49cdfc7eSAndroid Build Coastguard Worker
15*49cdfc7eSAndroid Build Coastguard WorkerTracing and debugging syscalls
16*49cdfc7eSAndroid Build Coastguard Worker------------------------------
17*49cdfc7eSAndroid Build Coastguard Worker
18*49cdfc7eSAndroid Build Coastguard WorkerThe new test library runs the actual test (i.e. the ``test()`` function) in a
19*49cdfc7eSAndroid Build Coastguard Workerforked process. To get stack trace of a crashing test in ``gdb`` it's needed to
20*49cdfc7eSAndroid Build Coastguard Worker`set follow-fork-mode child <https://sourceware.org/gdb/current/onlinedocs/gdb.html/Forks.html>`_.
21*49cdfc7eSAndroid Build Coastguard Worker
22*49cdfc7eSAndroid Build Coastguard WorkerTo trace the test, please use ``strace -f`` to enable tracing also for the
23*49cdfc7eSAndroid Build Coastguard Workerforked processes.
24