1 LTTng core dump snapshot handler
2 Christian Babeux, June 2013
4 This is a custom core dump program that will be called when a core dump
5 occurs. The program will save the core data in CORE_PATH and also, if a
6 root session daemon is running, will record a snapshot of tracing data
7 using the lttng command line utility.
9 The core dump snapshot handler can be installed by using the provided
10 install.sh script or by adding the appropriate program pipe line to
11 /proc/sys/kernel/core_pattern. Refer to core(5) for more information
12 about the Linux kernel core dump handling and custom handler mechanism.
17 Backup current core_pattern in core_pattern.bkp.
18 Successfully installed core_pattern.
22 You can use the provided test.sh script to test that the core dump snapshot
23 handler is working properly:
27 Spawning a session daemon
28 Session auto-20130626-224838 created.
29 Kernel channel chan enabled for session auto-20130626-224838
30 kernel event sched_switch created in channel chan
31 Tracing started for session auto-20130626-224838
34 ./test.sh: line 35: 16980 Segmentation fault (core dumped)
36 Waiting for data availability
37 Tracing stopped for session auto-20130626-224838
38 Session auto-20130626-224838 destroyed
39 Core dump and snapshot will be available in /tmp/lttng/{core,snapshot}.
57 Chaining with other core dump handler:
59 Some Linux distributions already use their own core dump handler
60 (such as systemd 'systemd-coredump' utility). It is possible to chain these
61 core dump utility with the core dump snapshot handler. In order to achieve
62 this, the core dump snapshot handler must be first in the chain (e.g.
63 installed in /proc/sys/kernel/core_pattern) and the other core dump
64 handler must be called from within the core dump snapshot handler script.
66 Example (chaining with systemd systemd-coredump):
68 # cat /proc/sys/kernel/core_pattern
69 |/path/to/lttng/handler.sh %p %u %g %s %t %h %e %E %c
71 In LTTng handler.sh script:
74 # Save core dump from stdin.
75 $MKDIR_BIN -p "${CORE_PATH}"
77 # Optional, chain core dump handler with original systemd script.
78 $CAT_BIN - | /usr/lib/systemd/systemd-coredump $p $u $g $s $t $e