使用gdb分析核心转储 - 由erlang应用程序生成

时间:2016-07-05 17:37:58

标签: debugging erlang gdb core coredump

我有一个由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

有任何帮助吗?谢谢!

1 个答案:

答案 0 :(得分:1)

  

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来自其他系统,而不是你想要分析它的系统。

仍然可以在Mac OS系统上分析core,但您需要:

  1. 一个跨gdb(即可以在Mac OS 主机上运行的那个,但可以处理目标的ELF文件;很可能是你&#39;我必须自己建立这样的GDB和
  2. (除非您有完全静态的可执行文件),您需要从发生崩溃的主机上获取完整的共享库集。见answer
  3. 一般情况下,在发生崩溃的主机上进行事后分析更容易