1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0 3# description: Generic dynamic event - add/remove/test uprobe events 4# requires: uprobe_events 5 6echo 0 > events/enable 7echo > dynamic_events 8 9echo 'cat /proc/$$/maps' | /bin/sh | \ 10 grep "r-xp .*/bin/.*sh$" | \ 11 awk '{printf "p:myevent %s:0x%s\n", $6,$3 }' >> uprobe_events 12 13grep -q myevent uprobe_events 14test -d events/uprobes/myevent 15 16echo 1 > events/uprobes/myevent/enable 17echo 'ls' | /bin/sh > /dev/null 18echo 0 > events/uprobes/myevent/enable 19grep -q myevent trace 20 21echo "-:myevent" >> uprobe_events 22! grep -q myevent uprobe_events 23 24echo > uprobe_events 25 26clear_trace 27