How to print all kernel functions associated with a process a.out when it enters in kernel mode. i.e.; I want to filter out the kernel functions for a specific pid/execname. Following is an stap script I created to trace the kernel functions associated with mm when process executes in kernel mode. This never succeed for me and I guess this is due to the volume of symbols stap is trying to track.
root@test:~/systemtap# cat test9.stp
#! /usr/bin/env stap
global traces
probe kernel.function("*@mm/*.c") {
traces[pid(), pexecname(), backtrace()] ++
}
probe end {
foreach ([pid, name, stack] in traces-) {
printf ("traces[%d,%s,\n", pid, name)
print_stack (stack)
printf ("] = %d\n", traces[pid, name, stack]);
}
}
root@test:~/systemtap# stap test9.stp
WARNING: probe kernel.function("is_errata93@/build/linux-pm2SeW/linux-5.15.0/arch/x86/mm/fault.c:417") (address 0xffffffffb329ebd4) registration error [man warning::pass5] (rc -22)
WARNING: probe kernel.function("do_sigbus@/build/linux-pm2SeW/linux-5.15.0/arch/x86/mm/fault.c:934") (address 0xffffffffb329ef28) registration error [man warning::pass5] (rc -22)
WARNING: probe kernel.function("spurious_kernel_fault@/build/linux-pm2SeW/linux-5.15.0/arch/x86/mm/fault.c:1007") (address 0xffffffffb329ef40) registration error [man warning::pass5] (rc -22)
WARNING: probe kernel.function("exc_page_fault@/build/linux-pm2SeW/linux-5.15.0/arch/x86/mm/fault.c:1497") (address 0xffffffffb3f9e780) registration error [man warning::pass5] (rc -22)
WARNING: probe kernel.function("do_user_addr_fault@/build/linux-pm2SeW/linux-5.15.0/arch/x86/mm/fault.c:1220") (address 0xffffffffb329e8d0) registration error [man warning::pass5] (rc -22)
WARNING: probe kernel.function("do_kern_addr_fault@/build/linux-pm2SeW/linux-5.15.0/arch/x86/mm/fault.c:1147") (address 0xffffffffb329f170) registration error [man warning::pass5] (rc -22)
WARNING: Missing unwind data for a module, rerun with 'stap -d kernel'
WARNING: too many pending (warning) messages
ERROR: too many pending (error) messages
WARNING: Number of errors: 1, skipped probes: 1891693
WARNING: /usr/bin/staprun exited with status: 1
Pass 5: run failed. [man error::pass5]
Number of similar warning messages suppressed: 38.
Rerun with -v to see them.