[PATCH] D33184: [DWARF] - Make collectAddressRanges() return section index in addition to Low/High PC

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 26 07:12:49 PDT 2017


grimar added a comment.

Had a bot failure in COFF code when tried to commit today, it revealed one more issue, that can be probably fixed easily.
My suggestion how to fix is below in comment.



================
Comment at: llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp:1006
 
+  Ret.SectionIndex = RSec->getIndex();
+
----------------
I suggest to do
```
Ret.SectionIndex = (RSec != Obj.section_end()) ? RSec->getIndex() : -1LL;
```
here ? (motivation is in comment below) 
So return -1LL for absolute values. At first I thought about Optional value,
but it seems an overkill here for me.




================
Comment at: llvm/trunk/lib/Object/COFFObjectFile.cpp:297
+uint64_t COFFObjectFile::getSectionIndex(DataRefImpl Sec) const {
+  return toSec(Sec) - SectionTable;
+}
----------------
This is the reason of BB fail:

```
******************** TEST 'LLVM :: DebugInfo/X86/dbg-value-regmask-clobber.ll' FAILED ********************
...
LLVM ERROR: Section was outside of section table.
********************
```

Code where is fails is:
```
  const coff_section *Addr = reinterpret_cast<const coff_section*>(Ref.p);

#ifndef NDEBUG
  // Verify that the section points to a valid entry in the section table.
  if (Addr < SectionTable || Addr >= (SectionTable + getNumberOfSections()))
    report_fatal_error("Section was outside of section table.");

```

And reason is that during call (from getSymbolInfo()):
```
Ret.SectionIndex = RSec->getIndex();
```

RSec was still Obj.section_end(), what looks fine for absolute values.


Repository:
  rL LLVM

https://reviews.llvm.org/D33184





More information about the llvm-commits mailing list