gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 11:53:48 25 4
gpt4 key购买 nike

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

最佳答案

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

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

您的直接问题是您的二进制文件:coredump.dbg 已以某种方式损坏。这是来自 readelf 的关键消息:错误:无法读取节标题的 0x900 字节

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

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

关于linux - 我在目标系统中生成了带有调试符号的 linux 核心转储。但是我无法在主机系统中使用 GDB 调试转储,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55139347/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com