Commit 2142e20f authored by Igor Kudrin's avatar Igor Kudrin
Browse files

[DWARF] Fix DWARFDebugAranges to support 64-bit CU offsets.

DWARFContext, the only user of this class, can already handle such offsets.

Differential Revision: https://reviews.llvm.org/D71834
parent 4b1d471f
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ class DWARFContext;
class DWARFDebugAranges {
public:
  void generate(DWARFContext *CTX);
  uint32_t findAddress(uint64_t Address) const;
  uint64_t findAddress(uint64_t Address) const;

private:
  void clear();
@@ -33,7 +33,7 @@ private:

  struct Range {
    explicit Range(uint64_t LowPC = -1ULL, uint64_t HighPC = -1ULL,
                   uint32_t CUOffset = -1U)
                   uint64_t CUOffset = -1ULL)
      : LowPC(LowPC), Length(HighPC - LowPC), CUOffset(CUOffset) {}

    void setHighPC(uint64_t HighPC) {
@@ -54,8 +54,8 @@ private:
    }

    uint64_t LowPC; /// Start of address range.
    uint32_t Length; /// End of address range (not including this address).
    uint32_t CUOffset; /// Offset of the compile unit or die.
    uint64_t Length; /// End of address range (not including this address).
    uint64_t CUOffset; /// Offset of the compile unit or die.
  };

  struct RangeEndpoint {
+2 −2
Original line number Diff line number Diff line
@@ -113,10 +113,10 @@ void DWARFDebugAranges::construct() {
  Endpoints.shrink_to_fit();
}

uint32_t DWARFDebugAranges::findAddress(uint64_t Address) const {
uint64_t DWARFDebugAranges::findAddress(uint64_t Address) const {
  RangeCollIterator It =
      partition_point(Aranges, [=](Range R) { return R.HighPC() <= Address; });
  if (It != Aranges.end() && It->LowPC <= Address)
    return It->CUOffset;
  return -1U;
  return -1ULL;
}