[PATCH] D63521: Teach the symbolizer lib symbolize objects directly.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 03:35:45 PDT 2019


MaskRay added inline comments.


================
Comment at: llvm/lib/DebugInfo/Symbolize/Symbolize.cpp:403
   ObjectPair Objects = ObjectsOrErr.get();
 
   std::unique_ptr<DIContext> Context;
----------------
I think we can split `getOrCreateModuleInfo` into two halves. The latter half can be reused by this part of code in the new `symbolizeCode`:

```
    std::unique_ptr<DIContext> Context =
        DWARFContext::create(Obj, nullptr, DWARFContext::defaultErrorHandler);
  /////////// codeview is not supported
    Expected<SymbolizableModule *> InfoOrErr =
        createModuleInfo(&Obj, std::move(Context), ModuleName);
    if (!InfoOrErr)
      return InfoOrErr.takeError();
    Info = InfoOrErr.get();
```

This way, it may make it easy to add codeview support for archive files is someone cares about it.

(`getOrCreateObjectPair` handles .gnu_debuglink, but I think we can forget about that for an archive member..


================
Comment at: llvm/lib/DebugInfo/Symbolize/Symbolize.cpp:470
                              DWARFContext::defaultErrorHandler, Opts.DWPName);
-  auto InfoOrErr =
-      SymbolizableObjectFile::create(Objects.first, std::move(Context));
-  std::unique_ptr<SymbolizableModule> SymMod;
-  if (InfoOrErr)
-    SymMod = std::move(InfoOrErr.get());
-  auto InsertResult =
-      Modules.insert(std::make_pair(ModuleName, std::move(SymMod)));
-  assert(InsertResult.second);
-  if (auto EC = InfoOrErr.getError())
-    return errorCodeToError(EC);
-  return InsertResult.first->second.get();
+  assert(Context);
+  return createModuleInfo(Objects.first, std::move(Context), ModuleName);
----------------
Nonnullness of Context is obvious.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63521





More information about the llvm-commits mailing list