| 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (C) 2013 Christian Babeux <christian.babeux@efficios.com> |
| 4 | # |
| 5 | # SPDX-License-Identifier: GPL-2.0-only |
| 6 | # |
| 7 | |
| 8 | SESSION_NAME="coredump-handler" |
| 9 | |
| 10 | # Just recording kernel event sched_switch as an example, but we can as |
| 11 | # well record user-space events from UST domain. |
| 12 | EVENT_NAME="sched_switch" |
| 13 | |
| 14 | SNAPSHOT_PATH="/tmp/lttng/snapshot" |
| 15 | SNAPSHOT_URI="file://${SNAPSHOT_PATH}" |
| 16 | |
| 17 | echo "Setup ${SESSION_NAME}..." |
| 18 | $LTTNG_BIN create ${SESSION_NAME} --snapshot -U ${SNAPSHOT_PATH} |
| 19 | $LTTNG_BIN enable-event ${EVENT_NAME} -k -s ${SESSION_NAME} |
| 20 | $LTTNG_BIN start ${SESSION_NAME} |
| 21 | |
| 22 | echo "Sleeping..." |
| 23 | sleep 10 |
| 24 | |
| 25 | echo "Crashing..." |
| 26 | $(dirname $0)/crash |
| 27 | |
| 28 | echo "Sleeping..." |
| 29 | sleep 10 |
| 30 | |
| 31 | $LTTNG_BIN stop ${SESSION_NAME} |
| 32 | $LTTNG_BIN destroy ${SESSION_NAME} |
| 33 | |
| 34 | echo "Core dump will be available in /tmp/lttng/core." |
| 35 | echo "Snapshot will be available in ${SNAPSHOT_PATH}." |