我可以在 Linux 上配置进入核心转储的内容吗?我想获得类似 Windows mini-dumps 的东西(应用程序崩溃时有关堆栈帧的最少信息).我知道您可以使用 ulimit 为核心文件设置最大大小,但这不允许我控制核心内部的内容(即不能保证如果我将限制设置为 64kb例如,将转储堆栈的最后 16 页).
Can I configure what goes into a core dump on Linux? I want to obtain something like the Windows mini-dumps (minimal information about the stack frame when the app crashed). I know you can set a max size for the core files using ulimit, but this does not allow me to control what goes inside the core (i.e. there is no guarantee that if I set the limit to 64kb it will dump the last 16 pages of the stack, for example).
另外,如果可能的话,我想以编程方式(从代码)设置它.我查看了 man core 提到的 /proc/PID/coredump_filter 文件,但对于我的目的来说,它似乎过于粗略.
Also, I would like to set it in a programmatic way (from code), if possible. I have looked at the /proc/PID/coredump_filter file mentioned by man core, but it seems too coarse grained for my purposes.
提供一点背景信息:出于多种原因,我需要很小的核心文件:我需要通过网络为众多(数千)客户收集它们;此外,这些是带有少量 SD 卡的嵌入式设备,以及用于网络连接的 GPRS 调制解调器.所以任何超过 200k 的东西都是不可能的.
To provide a little context: I need tiny core files, for multiple reasons: I need to collect them over the network, for numerous (thousands) of clients; furthermore, these are embedded devices with little SD cards, and GPRS modems for the network connection. So anything above ~200k is out of question.
我正在开发一个运行 linux 2.6.24 的嵌入式设备.处理器是 PowerPC.不幸的是,powerpc-linux 目前在 breakpad 中不支持,所以 google breakpad 不是一个选项
I am working on an embedded device which runs linux 2.6.24. The processor is PowerPC. Unfortunately, powerpc-linux is not supported in breakpad at the moment, so google breakpad is not an option
推荐答案我通过两种方式解决"了这个问题:
I have "solved" this issue in two ways:
我仍然丢失了可能很宝贵的信息(全局和局部变量内容、参数..).我可以很容易地找出要转储的页面,但不幸的是,没有办法为正常的核心转储指定转储这些页面"(除非你愿意去修补 maydump() 内核中的函数).
I still lose information that could be precious (global and local variable(s) content, params..). I could easily figure out which page(s) to dump, but unfortunately there is no way to specify a "dump-these-pages" for normal core dumps (unless you are willing to go and patch the maydump() function in the kernel).
目前,我对有 2 个解决方案感到非常满意(总比没有好.)我的下一步行动是:
For now, I'm quite happy with there 2 solutions (it is better than nothing..) My next moves will be:
- 看看将 Breakpad 移植到 powerpc-linux 有多么困难:已经有 powerpc-darwin 和 i386-linux 所以.. 有多难?:)
- 尝试使用 google-coredumper 在当前的 ESP(应该给我本地和参数)和&some_global"周围(应该给我全局).
- see how difficult would be to port Breakpad to powerpc-linux: there are already powerpc-darwin and i386-linux so.. how hard can it be? :)
- try to use google-coredumper to dump only a few pages around the current ESP (that should give me locals and parameters) and around "&some_global" (that should give me globals).
更多推荐
最小核心转储(仅堆栈跟踪 + 当前帧)
发布评论