[PATCH] D105985: Support GSYM in llvm-symbolizer.

Greg Clayton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 15 15:55:08 PDT 2021


clayborg requested changes to this revision.
clayborg added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/lib/DebugInfo/GSYM/GsymDIContext.cpp:27
+  if (Specifier.FNKind != DINameKind::None) {
+    LineInfo.FunctionName = static_cast<std::string>(Location.Name);
+  }
----------------



================
Comment at: llvm/lib/DebugInfo/GSYM/GsymDIContext.cpp:99-100
+DILineInfoTable
+GsymDIContext::getLineInfoForAddressRange(object::SectionedAddress Address,
+                                          uint64_t Size,
+                                          DILineInfoSpecifier Specifier) {
----------------
as long as we are doing this layer, we might as well fill this in. The code above is a good start. Something like:

```
if (Address.SectionIndex != llvm::object::SectionedAddress::UndefSection)
  return DILineInfoTable();

if (auto FuncInfoOrErr = Reader->getFunctionInfo(Address.Address)) {
  if (FuncInfoOrErr->OptLineTable) {
    const gsym::LineTable &LT = *FuncInfoOrErr->OptLineTable;
    const uint64_t StartAddr = Address.Address;
    const uint64_t EndAddr = Address.Address + Size;
    for (const auto &gsym::LineEntry : LT) {
      if (StartAddr <= LineEntry.Addr && LineEntry.Addr < EndAddr) {
        // Use LineEntry.Addr, LineEntry.File (which is a file index into the 
        // files tables from the GsymReader), and LineEntry.Line (source line
        // number) to add stuff to the DILineInfoTable
      }
    }
  }
} else {
  consumeError(LineTableOrErr.takeError());
  return DILineInfoTable();
}
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105985



More information about the llvm-commits mailing list