使用GDB生成核心转储文件时如何限制其大小
我正在 ARM9 板上运行嵌入式应用程序,其中总闪存大小仅为 180MB。我能够运行 gdb
,但是当我执行
(gdb)generate-core-dump
时出现错误,
warning: Memory read failed for corefile section, 1048576 bytes at 0x4156c000.
warning: Memory read failed for corefile section, 1048576 bytes at 0x50c00000.
Saved corefile core.5546
The program is running. Quit anyway (and detach it)? (y or n) [answered Y; input not from terminal]
Tamper Detected
**********OUTSIDE ifelse 0*********
length validation is failed
我还设置了 ulimit -c 50000
> 但核心转储仍然超出此限制。当我执行 ls -l 来检查文件大小时,它超过 300 MB。在这种情况下,我应该如何限制核心转储的大小?
I am running an embedded application on ARM9 board, where total flash size is 180MB only. I am able to run gdb
, but when I do
(gdb) generate-core-dump
I get an error
warning: Memory read failed for corefile section, 1048576 bytes at 0x4156c000.
warning: Memory read failed for corefile section, 1048576 bytes at 0x50c00000.
Saved corefile core.5546
The program is running. Quit anyway (and detach it)? (y or n) [answered Y; input not from terminal]
Tamper Detected
**********OUTSIDE ifelse 0*********
length validation is failed
I also set ulimit -c 50000
but still the core dump exceeds this limit. When I do ls -l
to check file size it is over 300 MB. In this case how should I limit the size of core dump?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
GDB 不尊重“ulimit -c”,只有内核尊重。
目前尚不清楚您是在目标板上运行 GDB,还是在开发主机上运行(并在目标上使用 gdbserver)。您可能应该使用后者,这将允许您收集完整的核心转储。
无论如何,截断的核心转储都是一种痛苦,因为它们通常不会包含调试问题所需的确切信息。
GDB does not respect 'ulimit -c', only the kernel does.
It's not clear whether you run GDB on target board, or on a development host (and using gdbserver on target). You probably should use the latter, which will allow you to collect full core dump.
Truncated core dumps are a pain anyway, as often they will not contain exactly the info you need to debug the problem.
在你的 shell rc 文件中:
应该为所有内容设置限制,包括 GDB
注意:
如果将其设置为 0 ,则可以确保你的主目录不会被核心转储文件弄乱。
in your shell rc-file:
that should set the limit for everything, including GDB
Note:
If you set it to 0 , you can make sure your home directory is not cluttered with core dump files.
你什么时候使用 ulimit -c ?必须在启动要为其生成核心转储的程序之前并在同一会话内使用它。
When did you use ulimit -c ? It must be used before starting the program for which you're generating a core dump, and inside the same session.