python - GDB+Python : Determining target type

标签 python gdb coredump

有没有办法确定调试目标是核心转储还是“实时”进程?

最佳答案

据我所知,Python 中没有专门的方法来做到这一点,但是,您仍然可以使用

  • gdb.execute("<command>", to_string=<boolean>)在 Python 中执行“CLI”命令,其中 to_stringTrue将告诉 GDB 收集输出并将其作为字符串返回(参见 doc )

  • maint print target-stack 它将打印内部使用的层以访问下层。如果核心调试层处于事件状态,您应该会看到“core (Local core dump file) ”。

总而言之,一些代码,例如

out = gdb.execute("maint print target-stack", to_string=True)
print "Local core dump file" in out

应该可以解决问题。

关于python - GDB+Python : Determining target type,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7510865/

相关文章:

python libsvm 核心转储

c - 进行指针操作时出现段错误(核心已转储)

python - Django 在输入链接时创建一个对象

python - 具有范围的Elastic Search复合分组

python - 运行 Sympy、Scipy、Numpy 和 Matplotlib 的最小 python 发行版

c++ - 试图让 curl 在 c++ linux 和 GDB 中工作

c++ - gdb - 重新设置一个常量

python - 你能在没有上下文的情况下返回 render() 吗?

objective-c - LLDB 相当于 Xcode 中 GDB 中的 'detach'?

c - 使用 gdb 检查调用者帧