[PATCH] D25822: [DWARF parsers] - Add a way to get section indices when call DWARFUnit::collectAddressRanges()

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 20 13:16:08 PDT 2016


grimar added a comment.

In https://reviews.llvm.org/D25822#575566, @clayborg wrote:

> Seems like a lot of work to include the section index everywhere. Can't the section index just be looked up using the ObjectFile given an address? Something like:
>
>   uint32_t ObjectFile::getSectionIndexForAddress(uint64_t addr);
>


Could you elaborate what addr should I use for such search ? 
getAddressRanges() returns me LowPC/HighPC.

For example for gdb-index-a.elf from https://reviews.llvm.org/D24706, LowPC = 0x0, HighPC = 0xb, readelf shows:

  Section Headers:
    [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
    [ 0]                   NULL            0000000000000000 000000 000000 00      0   0  0
    [ 1] .text             PROGBITS        0000000000000000 000040 00000b 00  AX  0   0  1
    [ 2] .data             PROGBITS        0000000000000000 00004b 000000 00  WA  0   0  1
    [ 3] .bss              NOBITS          0000000000000000 00004b 000000 00  WA  0   0  1
    [ 4] .debug_addr       PROGBITS        0000000000000000 00004b 000008 00      0   0  1
    [ 5] .rela.debug_addr  RELA            0000000000000000 000380 000018 18   I 23   4  8
  .....

How having just there values I can know that section I am looking is .text ?


https://reviews.llvm.org/D25822





More information about the llvm-commits mailing list