本文介绍了使用 GDB 生成核心转储文件时如何限制其大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 ARM9 板上运行嵌入式应用程序,总闪存大小仅为 180MB.我可以运行 gdb,但是当我运行时

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) 生成核心转储

我收到一个错误

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 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?

推荐答案

GDB 不支持 'ulimit -c',只有内核支持.

GDB does not respect 'ulimit -c', only the kernel does.

不清楚您是在目标板上运行 GDB,还是在开发主机上运行 GDB(并在目标上使用 gdbserver).您可能应该使用后者,它可以让您收集完整的核心转储.

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.

这篇关于使用 GDB 生成核心转储文件时如何限制其大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-19 01:43