[PATCH] D58848: [DebugInfo] follow up for "add SectionedAddress to DebugInfo interfaces"

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 22 14:43:03 PDT 2019


avl added a comment.

> Please move this down at least far enough that it doesn't involve separately 
> computing the file name and opening the file. Where it's a "well, if you didn't 
> specify a section index, we'll use the first section that covers this address".

It looks like this version of patch does exactly this. 
It does not open file separately and does not parse file name. 
The only thing which is additionally done is for already opened file :
"well, if you didn't specify a section index, we'll use the first section that covers this address" :

uint64_t SymbolizableObjectFile::getModuleSectionIndexForAddress(

    uint64_t Address) const {
  
  for (SectionRef Sec : Module->sections()) {
    if (!Sec.isText() || Sec.isVirtual())
      continue;
  
    if (Address >= Sec.getAddress() &&
        Address <= Sec.getAddress() + Sec.getSize()) {
      return Sec.getIndex();
    }
  }
  
  return object::SectionedAddress::UndefSection;

}

I think it looks very close to above description.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58848/new/

https://reviews.llvm.org/D58848





More information about the llvm-commits mailing list