10

OSXでgdbを使用していますが、gcorenorgenerate-core-fileコマンドもありません。

$ 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

4

2 に答える 2

14

を実行lldb --attach-pidし、process save-coreコマンドを使用してコアを保存します。アタッチするとすぐにプロセスが一時停止することに注意してください。重要なプロセスである場合は注意してください。

$ 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
...
于 2014-11-20T20:16:21.490 に答える
0

XCode+gdbでクラッシュしたアプリのコアファイルを生成する方法を参照してください。

また、新しいgdbにはMacOSで動作するgcoreがあるかもしれません。わかりませんが、検索して見つけることができます。

于 2013-07-18T14:12:46.077 に答える