首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在OSX上的gdb中转储核心(没有"gcore“或"generate- core -file")

在OSX上的gdb中转储核心(没有"gcore“或"generate- core -file")
EN

Stack Overflow用户
提问于 2012-05-01 00:15:40
回答 2查看 5.1K关注 0票数 10

我在OSX上使用gdb,它似乎既没有gcore也没有generate-core-file命令:

代码语言:javascript
复制
$ gdb
GNU gdb 6.3.50-20050815 (Apple version gdb-1705) (Fri Jul  1 10:50:06 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".
(gdb) gcore
Undefined command: "gcore".  Try "help".
(gdb) generate-core-file
Undefined command: "generate-core-file".  Try "help".
(gdb)

鉴于此,我该如何通过GDB生成一个核心转储或类似的转储?

(我怀疑我可以使用dump memory,但这需要一个地址范围,并且我正在努力寻找正确的info调用来获得正确的内存范围……)

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-11-21 04:16:21

运行lldb --attach-pid,然后使用process save-core命令保存核心。请注意,进程将从附加到它时立即暂停,因此如果这是一个重要的进程,请小心。

代码语言:javascript
复制
$ lldb --attach-pid <pid>
(lldb) process attach --pid 76669
Process 76669 stopped
Executable module set to "/bin/bash".
Architecture set to: x86_64h-apple-macosx.
(lldb) process save-core "core"
mach_header: 0xfeedfacf 0x01000007 0x00000008 0x00000004 0x00000030 0x00000e08 0x00000000 0x00000000
...
Saving data for segment at 0x7fd455200000
...
票数 14
EN

Stack Overflow用户

发布于 2013-07-18 22:12:46

请参阅How to generate a core file for a crashed app in XCode + gdb?

另外,也许一个较新的gdb有一个可以在MacOS上工作的gcore。我不知道,但你可以四处找找看。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10386921

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档