我已经在目标系统中生成了带有调试符号的linux核心转储。但是我无法在主机系统中使用GDB调试转储

时间:2019-03-13 10:15:48

标签: linux gdb coredump debug-symbols objcopy

我正在构建调试系统来调试在远程系统中崩溃的exe(例如coredump)。调试符号和核心转储(例如coredump.dbg,coredump_core.dump)一起发送到主机系统。在主机系统中,当我使用GDB分析转储时,遇到以下所有这些错误。请一些机构帮助如何将共享库发送到主机。如果是,那怎么办?

如何在主机系统的调试符号中链接共享库

以下是错误

1. readelf -a coredump.dbg

  ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
  Entry point address:               0x400720
  Start of program headers:          64 (bytes into file)
  Start of section headers:          14864 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         9
  Size of section headers:           64 (bytes)
  Number of section headers:         36
  Section header string table index: 35

  readelf: Error: Unable to read in 0x900 bytes of section headers

  readelf: Error: Section headers are not available!

2. gdb coredump.dbg coredump_core.dump

GNU gdb (GDB) Red Hat Enterprise Linux (7.2-92.el6)
Copyright (C) 2010 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-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
**"/root/coredump.dbg": not in executable format: File format not recognized
"/root/coredump_core.dump" is not a core dump: File format not recognized
(gdb)**

3.file coredump.dbg

coredump.dbg: ERROR: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),             statically linked (uses shared libs)error reading (Invalid argument)

1 个答案:

答案 0 :(得分:0)

  

如何在主机系统的调试符号中链接共享库

您的问题与共享库没有任何关系(您可能也有问题,但您应该首先解决眼前的问题)。

您的直接问题是您的二进制文件coredump.dbg在某种程度上已损坏。这是来自readelf: Error: Unable to read in 0x900 bytes of section headers的关键信息。

这可以通过几种不同的方式发生:

  1. 您有一个有问题的链接器(这不太可能)。
  2. 您正在使用objcopy和/或strip的某种组合,但操作不正确。
  3. 您以破坏文件和目标的方式在文件和目标之间传输文件(例如使用ASCII模式的FTP传输)。