Skip to content

Instantly share code, notes, and snippets.

@alwaysR9
Last active May 26, 2020 14:25
Show Gist options
  • Save alwaysR9/7dd302dcc7f26c8d2d2b4431dff8bff9 to your computer and use it in GitHub Desktop.
Save alwaysR9/7dd302dcc7f26c8d2d2b4431dff8bff9 to your computer and use it in GitHub Desktop.
watch a var in linux kernel
#! /usr/bin/env stap
probe kernel.statement("do_generic_file_read@mm/filemap.c:1772") {
printf("%s[%d] %s %ld:\n", execname(), tid(), pp(), $index);
}
probe kernel.function("submit_bio@block/blk-core.c") {
printf("%s[%d] %s i_sector:%lu, size:%u\n", execname(), tid(), pp(), $bio->bi_sector, $bio->bi_size);
}
>> stap -L 'kernel.function("finish_task_switch")'
<< kernel.function("finish_task_switch@kernel/sched/core.c:2376") $rq:struct rq* $prev:struct task_struct*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment