Ktap FFI Proposal

ktap FFI Proposal

1

FFI on Ktap

Foreign function interface

Programs of one programming language can call functions written in other languages

ktap

A new scripting dynamic tracing tool Especially designed for Linux!

2

Ktap code base

LOC userspace parser: 5000 LOC interpreter(in kernel): 6000 LOC

GPL licence

3

ktap script without FFI

trace sched:sched_switch { prio = curr_taskinfo(76, 8) pcount = curr_taskinfo(616, 8) run_delay = curr_taskinfo(624, 8) printf("%s[%d], %d, %d", arg1, prio, pcount, run_delay)

}

4

How I wrote the script

Use gdb to find the offset and size information inside struct:

(gdb) p &(((struct task_struct *)0).prio) $1 = (int *) 0x4c (gdb) p &(((struct task_struct *)0).sched_info.run_delay) $2 = (unsigned long long *) 0x270 (gdb) p &(((struct task_struct *)0).sched_info.pcount) $3 = (unsigned long *) 0x268

5

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download