如何打印内核调用堆栈及函数名

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何打印内核调用堆栈及函数名相关的知识,希望对你有一定的参考价值。

参考技术A static void
__report_bad_irq(unsigned int irq, struct irq_desc *desc,
irqreturn_t action_ret)

struct irqaction *action;

if (action_ret != IRQ_HANDLED && action_ret != IRQ_NONE)
printk(KERN_ERR "irq event %d: bogus return value %x\n",
irq, action_ret);
else
printk(KERN_ERR "irq %d: nobody cared (try booting with "
"the \"irqpoll\" option)\n", irq);

dump_stack();
printk(KERN_ERR "handlers:\n");

action = desc->action;
while (action)
printk(KERN_ERR "[<%p>]", action->handler);
print_symbol(" (%s)",
(unsigned long)action->handler);
printk("\n");
action = action->next;



==========================================================================================
irq 64: nobody cared (try booting with the "irqpoll" option)
Backtrace:
[<c0028940>] (dump_backtrace+0x0/0x104) from [<c0028a5c>] (dump_stack+0x18/0x1c)

r7:00000000 r6:00000040 r5:00000000 r4:c02dec10
[<c0028a44>] (dump_stack+0x0/0x1c) from [<c00692e0>] (__report_bad_irq+0x38/0x94
)
[<c00692a8>] (__report_bad_irq+0x0/0x94) from [<c00694a8>] (note_interrupt+0x16c
/0x1e0)
r4:c02dec10
[<c006933c>] (note_interrupt+0x0/0x1e0) from [<c0069fb4>] (handle_edge_irq+0x130
/0x150)
[<c0069e84>] (handle_edge_irq+0x0/0x150) from [<c002d98c>] (s3c_irq_demux_extint
8+0x94/0xa4)

Android系统源码或内核中打印函数调用堆栈(打印堆栈)

  1. 在Hal在打印堆栈
	
	新建一个dump_stack.h头文件,内容如下:
	#ifndef DUMP_STACK_H
	#define DUMP_STACK_H
	
	void dumping_callstack(void);
	
	#endif
	
	新建一个dump_stack

以上是关于如何打印内核调用堆栈及函数名的主要内容,如果未能解决你的问题,请参考以下文章

Android系统源码或内核中打印函数调用堆栈(打印堆栈)

Android系统源码或内核中打印函数调用堆栈(打印堆栈)

Android系统源码或内核中打印函数调用堆栈(打印堆栈)

php如何根据函数名打印出函数内容

c语言 如何打印函数指针名

内核中通过函数指针打印出具体的函数