使用GDB生成核心转储文件时如何限制其大小

发布于 2024-12-09 06:49:34 字数 638 浏览 4 评论 0原文

我正在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

夜空下最亮的亮点 2024-12-16 06:49:34

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.

软糖 2024-12-16 06:49:34

在你的 shell rc 文件中:

limit coredumpsize 50000             # or whatever limit size you like

应该为所有内容设置限制,包括 GDB

注意:

如果将其设置为 0 ,则可以确保你的主目录不会被核心转储文件弄乱。

in your shell rc-file:

limit coredumpsize 50000             # or whatever limit size you like

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.

感性 2024-12-16 06:49:34

你什么时候使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文