tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_syntax.tc

Source file repositories/reference/linux-study-clean/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_syntax.tc

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_syntax.tc
Extension
.tc
Size
2356 bytes
Lines
116
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

PROBEFUNC="vfs_read"
GOODREG=
BADREG=
GOODSYM="_sdata"
if ! grep -qw ${GOODSYM} /proc/kallsyms ; then
  GOODSYM=$PROBEFUNC
fi
BADSYM="deaqswdefr"
SYMADDR=0x`grep -w ${GOODSYM} /proc/kallsyms | cut -f 1 -d " "`
GOODTYPE="x16"
BADTYPE="y16"

case `uname -m` in
x86_64|i[3456]86)
  GOODREG=%ax
  BADREG=%ex
;;
aarch64)
  GOODREG=%x0
  BADREG=%ax
;;
arm*)
  GOODREG=%r0
  BADREG=%ax
;;
ppc*)
  GOODREG=%r3
  BADREG=%msr
;;
s390*)
  GOODREG=%r2
  BADREG=%s2
;;
mips*)
  GOODREG=%r4
  BADREG=%r12
;;
loongarch*)
  GOODREG=%r4
  BADREG=%r12
;;
riscv*)
  GOODREG=%a0
  BADREG=%a8
;;
*)
  echo "Please implement other architecture here"
  exit_untested
esac

test_goodarg() # Good-args
{
  while [ "$1" ]; do
    echo "p ${PROBEFUNC} $1" > kprobe_events
    shift 1
  done;
}

test_badarg() # Bad-args
{
  while [ "$1" ]; do
    ! echo "p ${PROBEFUNC} $1" > kprobe_events
    shift 1
  done;
}

echo > kprobe_events

: "Register access"
test_goodarg ${GOODREG}

Annotation

Implementation Notes