1

I am building a debugging system to debug a exe(e.g. coredump) which is crashed in remote system. The debug symbols along with the core dump (e.g. coredump.dbg, coredump_core.dump) is sent to host system. In host system when I use GDB to analyze a dump I am getting all these errors mentioned below. Some body please help how the shared libraries has to be sent to host. If yes, then how?

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

following are the errors

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)
  • What does `file coredump_core.dump` print? – Employed Russian Mar 14 '19 at 01:43
  • @EmployedRussian file coredump_core.dump coredump_core.dump: ELF 64-bit LSB core file x86-64, version 1 (SYSV), SVR4-style, from './coredump', real uid: 0, effective uid: 0, real gid: 0 – Lokesh Byatha Patalaiah Mar 14 '19 at 04:08
  • @EmployedRussian ftp transfer was the issue. When I load debug and core files in gdb, I am getting these warnings warning: Could not load shared library symbols for inking warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffca83dd000 Core was generated by `./coredump'. Program terminated with signal 11, Segmentation fault. #0 0x0000000000400848 in main () Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.212.0.1.el6.x86_64 libgcc-4.4.7-23.0.1.el6.x86_64 – Lokesh Byatha Patalaiah Mar 14 '19 at 05:56

1 Answers1

1

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

Your problem has nothing to do with any shared libraries (you may have a problem with them as well, but you should solve the immediate problem first).

Your immediate problem is that your binary: coredump.dbg has been corrupted in some way. This is the key message from readelf: Error: Unable to read in 0x900 bytes of section headers.

This could happen in a few different ways:

  1. You have a buggy linker (that is very unlikely).
  2. You are using some combination of objcopy and/or strip, and are not doing it correctly.
  3. You transfer the file between target and host in a way that corrupts it (using e.g. ASCII-mode FTP transfer).
Employed Russian
  • 199,314
  • 34
  • 295
  • 362