0

I'm trying to learn about linux kernel module development, and I see in several resources the use of dump_stack defined in linux/printk.h. I tried it, and it doesn't do anything, so I go to look in the header files included with linux 5.14 (linux-5.14/include/linux/printk.h) and I see the definition is

static inline void dump_stack(void)
{
}

Thinking I must have done something wrong getting the source, I check the header files included with the distribution of linux I am using (kali linux) in /usr/src/linux-headers-5.14.0-kali2-common/include/linux/printk.h and I see the same thing. What am I missing here?

  • 3
    There are **two declarations** of `dump_stack`, selected depending on the macro `CONFIG_PRINTK`: https://elixir.bootlin.com/linux/v5.14.20/source/include/linux/printk.h#L167. The one you show is applied when the macro is not defined. As you could guess, undefined macro `CONFIG_PRINTK` means that `printk` functionality is disabled (`printk` does nothing). The other declaration of `dump_stack` is at https://elixir.bootlin.com/linux/v5.14.20/source/include/linux/printk.h#L211. And corresponding definition is at https://elixir.bootlin.com/linux/v5.14.20/source/lib/dump_stack.c#L110 – Tsyvarev Jun 29 '22 at 09:30
  • *"I tried it, and it doesn't do anything"* - how did you try it? Show us a [mre]. – Marco Bonelli Jun 30 '22 at 00:19

0 Answers0