[PATCH] D79269: [NativeSession] Implement NativeSession::findSymbolByAddress.

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 5 16:45:17 PDT 2020


rnk added a comment.

Cool. :)



================
Comment at: llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp:339
+  // Search for the symbol in this module.
+  for (auto &Sym : ModS.getSymbolArray()) {
+    if (Sym.kind() != S_LPROC32 && Sym.kind() != S_GPROC32)
----------------
This is a `VarStreamArray`. I think you can skip past entire procedure regions by doing something like this:
  CVSymbolArray Syms = ModS.getSymbolArray();
  for (auto I = Syms.begin(), E = Syms.end(); I != E; ++I) {
    ...
    // If this is not the procsym you want
    I = Syms.at(PS.Next);
  }

Something like that, maybe.


================
Comment at: llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp:343
+    auto PS = cantFail(SymbolDeserializer::deserializeAs<ProcSym>(Sym));
+    if (PS.Segment == Sect && PS.CodeOffset == Offset) {
+      SymIndexId Id = createSymbol<NativeFunctionSymbol>(std::move(PS));
----------------
We discussed adjusting this condition to be a range check.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79269





More information about the llvm-commits mailing list