1

我正在构建一个调试系统来调试在远程系统中崩溃的 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.文件 coredump.dbg

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

1 回答 1

1

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

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

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

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

  1. 您有一个错误的链接器(这不太可能)。
  2. 您正在使用objcopy和/或的某种组合strip,并且没有正确执行。
  3. 您以破坏文件的方式在目标和主机之间传输文件(使用例如ASCII-mode FTP 传输)。
于 2019-03-14T05:01:27.660 回答