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

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon May 15 09:35:56 PDT 2017


> +uint64_t WasmObjectFile::getSectionIndex(DataRefImpl Sec) const {
> +  // TODO: COFFObjectFile::getSectionIndex() not implemented

You probably mean WasmObjectFile.

> Index: lib/DebugInfo/DWARF/DWARFUnit.cpp
> ===================================================================
> --- lib/DebugInfo/DWARF/DWARFUnit.cpp
> +++ lib/DebugInfo/DWARF/DWARFUnit.cpp
> @@ -349,18 +349,18 @@
>    if (Die.isSubroutineDIE()) {
>      for (const auto &R : Die.getAddressRanges()) {
>        // Ignore 0-sized ranges.
> -      if (R.first == R.second)
> +      if (R.LowPC == R.HighPC)
>          continue;
> -      auto B = AddrDieMap.upper_bound(R.first);
> -      if (B != AddrDieMap.begin() && R.first < (--B)->second.first) {
> +      auto B = AddrDieMap.upper_bound(R.LowPC);
> +      if (B != AddrDieMap.begin() && R.LowPC < (--B)->second.first) {
>          // The range is a sub-range of existing ranges, we need to split the
>          // existing range.
> -        if (R.second < B->second.first)
> -          AddrDieMap[R.second] = B->second;
> -        if (R.first > B->first)
> -          AddrDieMap[B->first].first = R.first;
> +        if (R.HighPC < B->second.first)
> +          AddrDieMap[R.HighPC] = B->second;
> +        if (R.LowPC > B->first)
> +          AddrDieMap[B->first].first = R.LowPC;
>        }
> -      AddrDieMap[R.first] = std::make_pair(R.second, Die);
> +      AddrDieMap[R.LowPC] = std::make_pair(R.HighPC, Die);

This patch is a bit hard to read because of the change from first to
LowPC and second to HighPC.

Since replacing std::pair is a nice thing anyway, could you do just that
in a patch?


> +struct DWARFAddress {
> +  uint64_t LowPC;
> +  uint64_t HighPC;
> +  uint64_t SecNdx;
> +};

I.E., have a patch just introducing

struct DWARFAddress {
  uint64_t LowPC;
  uint64_t HighPC;
};

and using it where appropriate.

Such a patch LGTM.

Cheers,
Rafael


More information about the llvm-commits mailing list