本文介绍了GDB 在 linux 中带有 coredump 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在 linux 中获得了一个核心转储文件

I just got a core-dump file in linux with

ulimit -c unlimited

如何将 gdb 与它连接起来

how can I attach gdb with it

我需要给它提供命令行参数.

I need to give command line arguments with it.

示例执行:

./my_prog arg

帮助我进入 gdb

干杯!!

推荐答案

如果你的核心文件是 core 就运行

If your core file is core just run

gdb ./my_prog core

core做一些事后分析.

如果您想在没有核心的情况下使用 gdb,请考虑

If you want to use gdb without your core, consider

gdb --args ./my_prog arg

或者只运行 gdb ./my_prog 然后向 gdb 发出 set args 命令.

or else run just gdb ./my_prog then issue the set args command to gdb.

如果您的进程仍以 pid 1234 运行,您可以使用 gdb ./my_prog 1234 将 gdb 附加到正在运行的进程.

If your process is still running as pid 1234, you could with gdb ./my_prog 1234 attach the gdb to the running process.

您确实应该阅读 gdb 文档.

这篇关于GDB 在 linux 中带有 coredump 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 12:03
查看更多