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

I have generated a linux core dump with debug symbols in target system. But I am unable to debug the dump using GDB in host system

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

我应该如何link主机系统调试符号中的共享库

错误如下

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)

How should I link the shared libraries in debug symbols in host system

您的问题与任何共享库无关(您也可能对它们有问题,但您应该先解决眼前的问题)。

您的直接问题是您的二进制文件:coredump.dbg 已以某种方式损坏。这是来自 readelf: Error: Unable to read in 0x900 bytes of section headers.

的关键信息

这可能会以几种不同的方式发生:

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