GDB 与 linux 中的 coredump 文件 [英] GDB With a coredump file in linux

查看:23
本文介绍了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 进行一些事后分析.

to do some post-mortem analysis with the 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 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆