kernel 调试-打印调用堆栈

代码修改

 增加dump_stack()函数

tatic int bcm2835_clk_probe(struct platform_device *pdev)
{
    struct device *dev = &pdev->dev;
    struct clk_hw **hws;
    struct bcm2835_cprman *cprman;
    struct resource *res;
    const struct bcm2835_clk_desc *desc;
    const size_t asize = ARRAY_SIZE(clk_desc_array);
    const struct cprman_plat_data *pdata;
    struct device_node *fw_node;
    size_t i;
    u32 clk_id;
    int ret;
    dump_stack();
    pdata = of_device_get_match_data(&pdev->dev);
    ........

}

输出展示

[    0.338902] Serial: AMBA PL011 UART driver
[    0.348399] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.19.127-v8+ #16
[    0.350153] Hardware name: Raspberry Pi 3 Model B+ (DT)
[    0.350571] Call trace:
[    0.351331]  dump_backtrace+0x0/0x178
[    0.351465]  show_stack+0x28/0x34
[    0.351567]  __dump_stack+0x20/0x28
[    0.351669]  dump_stack+0x88/0xc4
[    0.351770]  bcm2835_clk_probe+0x3c/0x248
[    0.351903]  platform_drv_probe+0x60/0xb4
[    0.352088]  really_probe+0x24c/0x294
[    0.352198]  driver_probe_device+0xa4/0xb4
[    0.352305]  __device_attach_driver+0x88/0xb4
[    0.352410]  bus_for_each_drv+0x7c/0xc4
[    0.352479]  __device_attach+0xe4/0x148
[    0.352565]  device_initial_probe+0x28/0x34
[    0.352659]  bus_probe_device+0x58/0xa8
[    0.352752]  device_add+0x248/0x36c
[    0.352863]  of_device_add+0x40/0x58
[    0.352974]  of_platform_device_create_pdata+0xbc/0x13c
[    0.353122]  of_platform_bus_create+0xe4/0x1a8
[    0.353262]  of_platform_bus_create+0x128/0x1a8
[    0.353397]  of_platform_populate+0x74/0xe4
[    0.353520]  of_platform_default_populate+0x44/0x54
[    0.353665]  of_platform_default_populate_init+0x84/0xcc
[    0.353819]  do_one_initcall+0xf4/0x280
[    0.353941]  do_initcall_level+0x18c/0x194
[    0.354071]  do_initcalls+0x38/0x40
[    0.354183]  do_basic_setup+0x30/0x38
[    0.354300]  kernel_init_freeable+0xdc/0x1a0
[    0.354431]  kernel_init+0x18/0xfc
[    0.354561]  ret_from_fork+0x10/0x18

  • 29
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

乐分享-程序员

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值