[lldb-dev] ELF header does not hold big modules

Eugene Birukov via lldb-dev lldb-dev at lists.llvm.org
Fri Jan 20 16:42:52 PST 2017


Hello,


I have a core dump that LLDB cannot open because it contains more than 64K sections. The "readelf" utility gives me the output in the end of this message. It seems that the actual number of program headers and the index of string table section are written into very first section since they do not fit in 16 bits.


The "natural" way to deal with this problem would be to change the types of fields in ELFHeader struct from 16 to 32 bits (or should I go all the way and  do it 64? in case the core dump is bigger than 4GB...) and deal with the problem in a single place where we parse the header - the ELFHeader::Parse().


Objections? Suggestions? Advices?


Hmm... I am not sure that the DataExtractor we pass down there would let me read that much past in the file - I have impression that we give only first 512 bytes there, but I might be mistaken...


Thanks,

Eugene


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:                              CORE (Core file)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
  Entry point address:               0x0
  Start of program headers:          64 (bytes into file)
  Start of section headers:          16880770624 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         65535 (106714)
  Size of section headers:           64 (bytes)
  Number of section headers:         0 (106716)
  Section header string table index: 65535 (106715)

Section Headers:
  [Nr] Name              Type             Address           Offset
       Size              EntSize          Flags  Link  Info  Align
  [ 0]                   NULL             0000000000000000  00000000
       000000000001a0dc  0000000000000000          106715   106714     0
  [ 1] note0             NOTE             0000000000000000  005b2ff0
       00000000000b2e38  0000000000000000   A       0     0     1
  [ 2] load              PROGBITS         000000006a400000  00665e28
       0000000000001000  0000000000000000   A       0     0     1
  [ 3] load              PROGBITS         000000006a401000  00666e28






Sent from Outlook<http://aka.ms/weboutlook>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20170121/27582615/attachment.html>


More information about the lldb-dev mailing list