简体   繁体   English

获取Linux内核的dump_stack到char数组而不是控制台

[英]Get linux kernel's dump_stack to char array instead of to console

So, when I call dump_stack(), it printk's to dmesg. 因此,当我调用dump_stack()时,它将printk转换为dmesg。 But, I need it to, let's say, 'print' it to char array, so that I could display the stack much, much later, in a different place. 但是,我需要将其“打印”到char数组中,这样我才能在以后的很多地方显示堆栈。

Is it possible? 可能吗? It would help me sooo much with debugging a nasty bug I'm having! 调试我遇到的一个讨厌的错误将对我有很大帮助!

The tool that you need is called save_stack_trace . 您需要的工具称为save_stack_trace

First read Baruch's Linux kernel deferred stack trace blog . 首先阅读Baruch的Linux内核延迟堆栈跟踪博客 Then read Eugene's answer to a similar SO post. 然后阅读Eugene对类似SO帖子的回答

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM