bpftrace.sh: append enums at end of script

bpftrace scripts do not allow struct definitions after
the first probe definition (including BEGIN/END).
This is problematic for an upcoming patch which will
include some struct defintions.

So instead just add the generated BEGIN/END probes
with enum definitions to the end of the user-specified
script, instead of the beginning.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I7bc8c18c0891ee26edc099aef96ea18ed63ccb72

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9670
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Jim Harris 2021-09-28 07:07:52 -07:00 committed by Tomasz Zawadzki
parent e8c467965e
commit 88f9411281

View File

@ -10,8 +10,8 @@ if [ $# -lt 2 ]; then
fi
SCRIPTS_DIR=$(readlink -f $(dirname $0))
BIN_PATH=$(readlink -f /proc/$1/exe)
BPF_SCRIPT=$($SCRIPTS_DIR/bpf/gen_enums.sh)
BPF_SCRIPT+=$(sed "s#__EXE__#${BIN_PATH}#g" "${@:2}" | sed "s#__PID__#${1}#g")
BPF_SCRIPT=$(sed "s#__EXE__#${BIN_PATH}#g" "${@:2}" | sed "s#__PID__#${1}#g")
BPF_SCRIPT+=$($SCRIPTS_DIR/bpf/gen_enums.sh)
if [ -n "$ECHO_SCRIPT" ]; then
echo "$BPF_SCRIPT"
fi