Fichiers
rocm-systems/projects/rocprofiler-systems/tests/run-omnitrace-pid.sh
T
Jonathan R. Madsen f5a3099801 Fix attaching to running process, i.e. omnitrace -p <PID> (#60)
* Fix attaching to a process

- e.g. omnitrace -p <PID>

* Update /proc/sys/kernel/yama/ptrace_scope in CI

* Query /proc/sys/kernel/yama/ptrace_scope

* Use AUTHOR_WARNING instead of WARNING for ptrace_scope

[ROCm/rocprofiler-systems commit: fe3d15a6c9]
2022-06-21 00:28:20 -05:00

46 lignes
595 B
Bash
Fichiers exécutables

#!/bin/bash
cleanup()
{
kill -s 9 ${_PID}
}
trap cleanup SIGABRT SIGQUIT
OMNITRACE_COMMAND=""
APPLICATION_COMMAND=""
while [[ $# -gt 0 ]]
do
if [ "${1}" == "--" ]; then
shift
break
else
OMNITRACE_COMMAND="${OMNITRACE_COMMAND}${1} "
shift
fi
done
${@} &
_PID=$!
echo ""
ps ax | grep "${1}"
echo ""
if [ "${_PID}" = "" ]; then
echo "Error! No PID for \"${@}\""
exit -1
fi
echo "PID: ${_PID}"
echo ""
${OMNITRACE_COMMAND} -p ${_PID} -- ${@}
RET=$?
killall $(basename ${1}) &> /dev/null
echo "Exiting with code: ${RET}"
exit ${RET}