使用 gdb 分析核心转储 - 由 erlang 应用程序生成
using gdb to analyze core dump - generated by an erlang application
我有一个由 erlang 应用程序生成的核心转储文件,我想对其进行分析。这是我第一次使用 gdb。我安装了 gdb,但没有成功 运行将其与可执行文件和核心转储文件结合使用。
我将可执行文件和核心转储提供给 gdb
gdb erts-5.9.3/bin/beam.smp core
当我 运行 我得到
GNU gdb (GDB) 7.9
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or
later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin15.4.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from erts-5.9.3/bin/beam.smp...(no debugging symbols found)...done.
"/Users/sad/projects/core" is not a core dump: File format not recognized
有什么帮助吗?谢谢!
This GDB was configured as "x86_64-apple-darwin15.4.0".
"/Users/sad/projects/core" is not a core dump: File format not recognized
$ file core
/Users/sad/projects/core: ELF 64-bit LSB core file x86-64, version 1 (SYSV), ...
Mac OS 不使用 ELF
文件格式。我们可以放心地假设这个 core
来自其他系统,而不是您试图对其进行分析的系统。
在MacOS系统上还是可以分析出core
的,但是需要:
- a cross-gdb(即可以 运行 on Mac OS host,但可以处理 ELF 文件的target;很可能你必须自己构建这样的 GDB)和
- (除非您有一个完全静态的可执行文件),您需要 完整的 组来自发生崩溃的主机的共享库。看到这个 answer.
一般来说,对发生崩溃的主机进行post-mortem 分析要容易。
我有一个由 erlang 应用程序生成的核心转储文件,我想对其进行分析。这是我第一次使用 gdb。我安装了 gdb,但没有成功 运行将其与可执行文件和核心转储文件结合使用。
我将可执行文件和核心转储提供给 gdb
gdb erts-5.9.3/bin/beam.smp core
当我 运行 我得到
GNU gdb (GDB) 7.9
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or
later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin15.4.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from erts-5.9.3/bin/beam.smp...(no debugging symbols found)...done.
"/Users/sad/projects/core" is not a core dump: File format not recognized
有什么帮助吗?谢谢!
This GDB was configured as "x86_64-apple-darwin15.4.0".
"/Users/sad/projects/core" is not a core dump: File format not recognized
$ file core
/Users/sad/projects/core: ELF 64-bit LSB core file x86-64, version 1 (SYSV), ...
Mac OS 不使用 ELF
文件格式。我们可以放心地假设这个 core
来自其他系统,而不是您试图对其进行分析的系统。
在MacOS系统上还是可以分析出core
的,但是需要:
- a cross-gdb(即可以 运行 on Mac OS host,但可以处理 ELF 文件的target;很可能你必须自己构建这样的 GDB)和
- (除非您有一个完全静态的可执行文件),您需要 完整的 组来自发生崩溃的主机的共享库。看到这个 answer.
一般来说,对发生崩溃的主机进行post-mortem 分析要容易。