linux kernel prints the function name method corresponding to the function pointer
- 2020-05-15 03:23:14
- OfStack
Function Pointers are used a lot in the kernel, so it is very convenient to be able to directly print out the corresponding function of a function pointer in debug.
Print the bare pointer (raw pointer) with %p,%p can print other information besides the pointer
%pF prints the function name and offset address of the function pointer, %pf prints only the function name of the function pointer, not the offset address.
Such as
printk("%pf %pF\n", ptr, ptr) will print:
module_start module_start+0x0/0x62 [hello]
But to support this you need to turn on the CONFIG_KALLSYMS option