Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
433 views
in Technique[技术] by (71.8m points)

debugging - How to add inline function info in dump_stack() of Linux Kernel?

Obviously, we can use dump_stack() in Linux Kernel to get the call stack information, but I found the inline function information is lacking in the output of dump_stack().

For example: The call stack is:

 dont_mount include/linux/dcache.h:355 [inline]
 vfs_unlink+0x269/0x3b0
 do_unlinkat+0x28a/0x4d0
 __do_sys_unlink fs/namei.c:3945 [inline]
 __se_sys_unlink fs/namei.c:3943 [inline]
 __x64_sys_unlink+0x2c/0x30
 do_syscall_64+0x39/0x80
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

But through dump_stack(), I can only get this:

vfs_unlink+0x269/0x3b0
 do_unlinkat+0x28a/0x4d0
  __x64_sys_unlink+0x2c/0x30
 do_syscall_64+0x39/0x80
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Obviously, inline functions are missing, when I look at the source code of the implementation of dump_stack(), seems the inline functions are not within the kernel_text_address(). Is there any way to get the ** call stack including the inline function calls **?

I tried to use compile option -fno-inline to disable inlining function, but then kernel failed to be compiled. Seems not a good idea.

question from:https://stackoverflow.com/questions/65946350/how-to-add-inline-function-info-in-dump-stack-of-linux-kernel

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Let's see the wiki definition.

An inline function is a function that is expanded inline when it is invoked, thus saving time. The compiler replaces the function call with the corresponding function code, which reduces the overhead of function calls.

So here is no "call stack including the inline function calls"


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...