Fix all -Wmissing-declarations warning instances
[lttng-tools.git] / extras / core-handler / README
CommitLineData
57f0bd0c
CB
1LTTng core dump snapshot handler
2Christian Babeux, June 2013
3
4This is a custom core dump program that will be called when a core dump
5occurs. The program will save the core data in CORE_PATH and also, if a
6root session daemon is running, will record a snapshot of tracing data
7using the lttng command line utility.
8
9The core dump snapshot handler can be installed by using the provided
10install.sh script or by adding the appropriate program pipe line to
11/proc/sys/kernel/core_pattern. Refer to core(5) for more information
12about the Linux kernel core dump handling and custom handler mechanism.
13
14Installation:
15
16# ./install.sh
17Backup current core_pattern in core_pattern.bkp.
18Successfully installed core_pattern.
19
20How to use:
21
22You can use the provided test.sh script to test that the core dump snapshot
23handler is working properly:
24
25# ./test.sh
c071ccd9
MD
26Setup coredump-handler...
27Session coredump-handler created.
28Default snapshot output set to: /tmp/lttng/snapshot
29Snapshot mode set. Every channel enabled for that session will be set in overwrite mode and mmap output
30kernel event sched_switch created in channel channel0
31Tracing started for session coredump-handler
57f0bd0c
CB
32Sleeping...
33Crashing...
c071ccd9
MD
34Segmentation fault (core dumped)
35Sleeping...
57f0bd0c 36Waiting for data availability
c071ccd9
MD
37Tracing stopped for session coredump-handler
38Session coredump-handler destroyed
39Core dump will be available in /tmp/lttng/core.
40Snapshot will be available in /tmp/lttng/snapshot.
57f0bd0c
CB
41
42# tree /tmp/lttng
43/tmp/lttng
c071ccd9
MD
44├── core
45│   └── core.29085
46└── snapshot
47 └── snapshot-1-20130719-175041-0
48 └── kernel
49 ├── channel0_0
50 ├── channel0_1
51 ├── channel0_2
52 ├── channel0_3
53 └── metadata
57f0bd0c
CB
54
55Chaining with other core dump handler:
56
57Some Linux distributions already use their own core dump handler
58(such as systemd 'systemd-coredump' utility). It is possible to chain these
59core dump utility with the core dump snapshot handler. In order to achieve
60this, the core dump snapshot handler must be first in the chain (e.g.
61installed in /proc/sys/kernel/core_pattern) and the other core dump
62handler must be called from within the core dump snapshot handler script.
63
64Example (chaining with systemd systemd-coredump):
65
66# cat /proc/sys/kernel/core_pattern
67|/path/to/lttng/handler.sh %p %u %g %s %t %h %e %E %c
68
69In LTTng handler.sh script:
70
71[...]
72# Save core dump from stdin.
c071ccd9
MD
73#$MKDIR_BIN -p "${CORE_PATH}"
74#$CAT_BIN - > "${CORE_PATH}/${CORE_PREFIX}.$p"
57f0bd0c
CB
75
76# Optional, chain core dump handler with original systemd script.
77$CAT_BIN - | /usr/lib/systemd/systemd-coredump $p $u $g $s $t $e
78[...]
This page took 0.033749 seconds and 4 git commands to generate.