简体   繁体   English

无法生成核心转储文件

[英]Cannot generate core dump file

I've been getting segmentation fault errors on a vulkan renderer I wrote in c++ and the terminal says it has been core dumped, I want to send the core dump file through gdb to debug where the segmentation fault is happening, but I cannot find the core dump file in the project directory nor anywhere else.我在 c++ 中编写的 vulkan 渲染器上出现分段错误错误,终端说它已被核心转储,我想通过 gdb 发送核心转储文件以调试发生分段错误的位置,但我找不到项目目录或其他任何地方的核心转储文件。 I noticed that in apport.logs ( the apport.logs file ) it appears as if the core limit is set to 0, so I suppose no core dump file is being generated.我注意到在 apport.logs( apport.logs 文件)中,它看起来好像核心限制设置为 0,所以我想没有生成核心转储文件。 I tried changing the ulimit -c limit in the shell session where I want to generate the core dump, but it does not seem to work.我尝试在要生成核心转储的 shell session 中更改 ulimit -c 限制,但它似乎不起作用。 I also tried setting the core dump limit to unlimited on limits.conf, it didn't work too.我还尝试在limits.conf上将核心转储限制设置为无限制,它也不起作用。 Please help.请帮忙。

I want to send the core dump file through gdb to debug where the segmentation fault is happening我想通过 gdb 发送核心转储文件以调试发生分段错误的位置

Note that you don't need a core dump to debug -- you can debug a live process instead.请注意,您不需要core转储来调试 - 您可以调试实时进程。 Just do gdb --args /path/to/binary args... .只需做gdb --args /path/to/binary args... Then use run to run the binary, and where once GDB stops due to a crash.然后使用run运行二进制文件where一旦 GDB 由于崩溃而停止。

If you really want to get a core , you can tweak /proc/sys/kernel/core_pattern .如果你真的想得到一个core ,你可以调整/proc/sys/kernel/core_pattern Use cat /proc/sys/kernel/core_pattern to see where the core dumps are currently going (probably a pipe to apport ).使用cat /proc/sys/kernel/core_pattern查看core转储当前的去向(可能是 pipe 到apport )。

Use echo core | sudo tee /proc/sys/kernel/core_pattern使用echo core | sudo tee /proc/sys/kernel/core_pattern echo core | sudo tee /proc/sys/kernel/core_pattern to make core appear in the current directory. echo core | sudo tee /proc/sys/kernel/core_pattern使core出现在当前目录中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM