How to limit the size of core dump file when generating it using GDB

老子叫甜甜 提交于 2019-12-01 16:42:59

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.

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!