Thursday, March 24, 2011

Function caller in linux kernel

http://stackoverflow.com/questions/4141324/function-caller-in-linux-kernel

Note, printk with %pS is only supported on later version of Linux. Ref:
http://lwn.net/Articles/289064/

Another article about kallsyms_lookup:
http://daydreamer.idv.tw/rewrite.php/read-55.html

Note: when using __builtin_return_address(0), you cannot replace 0 with a variable such as int i; otherwise, you will get some compiling error.

Also, be careful when tracing back too much, such as __builtin_return_address(10). If the call stack is not as deep as 10, the kernel will happily crash.

No comments: