gdb 导入时崩溃/退出时的进程转储?
我有 C++ 软件(服务器)并且它崩溃了,我不太清楚 问题是基于日志的。我想做一些linux之后的东西 崩溃或退出转储该进程,我将以某种方式导入该进程 文件到 gdb
并分析什么是不应该做的。
有人过去做过某事吗? 有人可以帮助我提供一些信息想法或其他东西吗?
谢谢!
I have C++ software (server) and its crashing, i don't know exactly
where problem is based on logs. I want make something that linux after
crash or quit do dump of that process that i will someway import that this
file to gdb
and analyze what is doing what not should.
Anyone do something in past?
Can someone help me with some informations ideas or something?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您想要的是一个常规的核心转储,它与 GDB 一起查找崩溃位置。
有关信息,请参阅 http://linux.die.net/man/5/core。
如果守护进程没有当前目录的写权限,则不会生成核心。要重定向它,请尝试;
What you want is a regular core dump which works with GDB to find the crash location.
See http://linux.die.net/man/5/core for information.
If the daemon does not have write permission where the current directory is, no core will be generated. To redirect it, try;
您在寻找核心文件吗?在启动守护进程的脚本中,添加以下命令(假设脚本的解释器是 bash):
将核心文件的最大大小设置为“无限制”(默认情况下通常为 0)。
Are you looking for a core file? In the script that launches your daemon, add this command (assuming the interpreter for the script is
bash
):That set the maximum size of a core file to "unlimited" (it's usually 0 by default).
正如其他人回答的那样,您可以获得核心转储文件。请务必正确配置您的环境。
另一种方法是,一旦守护进程已经运行并在崩溃之前,附加它通过调试器。
您还可以使用
gdb --args
/path/to/daemon daemon-arguments 启动守护进程 ...As others replied, you can get a core dump file. Be sure to configure your environment appropriately.
Another way, once the daemon is already running and before it crashes, is to attach it thru the debugger.
And you can also start your daemon with
gdb --args
/path/to/daemon daemon-arguments ...