dump_stack是用来回溯内核运行的信息的,打印内核信息堆栈段;

 

dump_stack原型:

void dump_stack(void);

 

1、使用这个功能时需要将内核配置勾选上;

make menuconfig -> kernel hacking--> kernel debug

 

 

2、在函数中使用:

 1 #include <linux/module.h>
 2 #include <linux/init.h>
 3 #include <linux/kprobes.h>
 4 #include <asm/traps.h>
 5  
 6 MODULE_LICENSE("Dual BSD/GPL");
 7   
 8 static int __init hello_init(void)
 9 {
10      printk(KERN_ALERT "dump_stack start\n");
11      dump_stack();
12      printk(KERN_ALERT "dump_stack over\n");
13      return 0;
14  }
15  static void __exit hello_exit(void)
16  {
17       printk(KERN_ALERT "test module\n");
18  }
19  
20 module_init(hello_init);
21 module_exit(hello_exit);
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-31
  • 2021-12-31
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
猜你喜欢
  • 2021-11-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
相关资源
相似解决方案