[all-commits] [llvm/llvm-project] 18eefc: Modify llvm-gsymutil lookups to handle overlapping...

Greg Clayton via All-commits all-commits at lists.llvm.org
Fri Nov 17 10:31:26 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 18eefc186d75f60c9a828e13a8379769eb5c1812
      https://github.com/llvm/llvm-project/commit/18eefc186d75f60c9a828e13a8379769eb5c1812
  Author: Greg Clayton <gclayton at fb.com>
  Date:   2023-11-17 (Fri, 17 Nov 2023)

  Changed paths:
    M llvm/include/llvm/DebugInfo/GSYM/GsymReader.h
    M llvm/lib/DebugInfo/GSYM/GsymReader.cpp
    M llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp

  Log Message:
  -----------
  Modify llvm-gsymutil lookups to handle overlapping ranges correctly. (#72350)

llvm-gsymutil allows address ranges to overlap. There was a bug where if
we had debug info for a function with a range like [0x100-0x200) and a
symbol at the same start address yet with a larger range like
[0x100-0x300), we would randomly get either only information from the
first or second entry. This could cause lookups to fail due to the way
the binary search worked.

This patch makes sure that when lookups happen we find the first address
table entry that can match an address, and also ensures that we always
select the first FunctionInfo that could match. FunctionInfo entries are
sorted such that the most debug info rich entries come first. And if we
have two ranges that have the same start address, the smaller range
comes first and the larger one comes next. This patch also adds the
ability to iterate over all function infos with the same start address
to always find a range that contains the address.

Added a unit test to test this functionality that failed prior to this
fix and now succeeds.

Also fix an issue when dumping an entire GSYM file that has duplicate address entries where it used to always print out the binary search match for the FunctionInfo, not the actual data for the address index.




More information about the All-commits mailing list