<div dir="ltr">I think this broke the build of one of the unit tests.<div><br></div><div>unittests/DebugInfo/PDB/PDBApiTest.cpp:398:23: error: allocating an object of abstract class type '(anonymous namespace)::MockSession'<br></div><div><div>                      ^</div><div>include/llvm/DebugInfo/PDB/IPDBSession.h:48:3: note: unimplemented pure virtual method 'findSymbolByRVA' in 'MockSession'</div><div>  findSymbolByRVA(uint32_t RVA, PDB_SymType Type) const = 0;</div><div>  ^</div><div>include/llvm/DebugInfo/PDB/IPDBSession.h:50:3: note: unimplemented pure virtual method 'findSymbolBySectOffset' in 'MockSession'</div><div>  findSymbolBySectOffset(uint32_t Sect, uint32_t Offset,</div></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div>
<br><div class="gmail_quote">On Tue, Apr 10, 2018 at 10:33 AM, Aaron Smith via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: asmith<br>
Date: Tue Apr 10 10:33:18 2018<br>
New Revision: 329724<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=329724&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=329724&view=rev</a><br>
Log:<br>
[DebugInfoPDB] Add DIA implementations of findSymbolByRVA and findSymbolByAddr<br>
<br>
Modified:<br>
    llvm/trunk/include/llvm/<wbr>DebugInfo/PDB/DIA/DIASession.h<br>
    llvm/trunk/include/llvm/<wbr>DebugInfo/PDB/IPDBSession.h<br>
    llvm/trunk/include/llvm/<wbr>DebugInfo/PDB/Native/<wbr>NativeSession.h<br>
    llvm/trunk/lib/DebugInfo/PDB/<wbr>DIA/DIASession.cpp<br>
    llvm/trunk/lib/DebugInfo/PDB/<wbr>Native/NativeSession.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/<wbr>DebugInfo/PDB/DIA/DIASession.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIASession.h?rev=329724&r1=329723&r2=329724&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/include/<wbr>llvm/DebugInfo/PDB/DIA/<wbr>DIASession.h?rev=329724&r1=<wbr>329723&r2=329724&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/include/llvm/<wbr>DebugInfo/PDB/DIA/DIASession.h (original)<br>
+++ llvm/trunk/include/llvm/<wbr>DebugInfo/PDB/DIA/DIASession.h Tue Apr 10 10:33:18 2018<br>
@@ -41,6 +41,11 @@ public:<br>
<br>
   std::unique_ptr<PDBSymbol><br>
   findSymbolByAddress(uint64_t Address, PDB_SymType Type) const override;<br>
+  std::unique_ptr<PDBSymbol> findSymbolByRVA(uint32_t RVA,<br>
+                                             PDB_SymType Type) const override;<br>
+  std::unique_ptr<PDBSymbol><br>
+  findSymbolBySectOffset(uint32_<wbr>t Section, uint32_t Offset,<br>
+                         PDB_SymType Type) const override;<br>
<br>
   std::unique_ptr<<wbr>IPDBEnumLineNumbers><br>
   findLineNumbers(const PDBSymbolCompiland &Compiland,<br>
<br>
Modified: llvm/trunk/include/llvm/<wbr>DebugInfo/PDB/IPDBSession.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/IPDBSession.h?rev=329724&r1=329723&r2=329724&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/include/<wbr>llvm/DebugInfo/PDB/<wbr>IPDBSession.h?rev=329724&r1=<wbr>329723&r2=329724&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/include/llvm/<wbr>DebugInfo/PDB/IPDBSession.h (original)<br>
+++ llvm/trunk/include/llvm/<wbr>DebugInfo/PDB/IPDBSession.h Tue Apr 10 10:33:18 2018<br>
@@ -44,6 +44,11 @@ public:<br>
<br>
   virtual std::unique_ptr<PDBSymbol><br>
   findSymbolByAddress(uint64_t Address, PDB_SymType Type) const = 0;<br>
+  virtual std::unique_ptr<PDBSymbol><br>
+  findSymbolByRVA(uint32_t RVA, PDB_SymType Type) const = 0;<br>
+  virtual std::unique_ptr<PDBSymbol><br>
+  findSymbolBySectOffset(uint32_<wbr>t Sect, uint32_t Offset,<br>
+                         PDB_SymType Type) const = 0;<br>
<br>
   virtual std::unique_ptr<<wbr>IPDBEnumLineNumbers><br>
   findLineNumbers(const PDBSymbolCompiland &Compiland,<br>
<br>
Modified: llvm/trunk/include/llvm/<wbr>DebugInfo/PDB/Native/<wbr>NativeSession.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeSession.h?rev=329724&r1=329723&r2=329724&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/include/<wbr>llvm/DebugInfo/PDB/Native/<wbr>NativeSession.h?rev=329724&r1=<wbr>329723&r2=329724&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/include/llvm/<wbr>DebugInfo/PDB/Native/<wbr>NativeSession.h (original)<br>
+++ llvm/trunk/include/llvm/<wbr>DebugInfo/PDB/Native/<wbr>NativeSession.h Tue Apr 10 10:33:18 2018<br>
@@ -60,6 +60,11 @@ public:<br>
<br>
   std::unique_ptr<PDBSymbol><br>
   findSymbolByAddress(uint64_t Address, PDB_SymType Type) const override;<br>
+  std::unique_ptr<PDBSymbol> findSymbolByRVA(uint32_t RVA,<br>
+                                             PDB_SymType Type) const override;<br>
+  std::unique_ptr<PDBSymbol><br>
+  findSymbolBySectOffset(uint32_<wbr>t Sect, uint32_t Offset,<br>
+                         PDB_SymType Type) const override;<br>
<br>
   std::unique_ptr<<wbr>IPDBEnumLineNumbers><br>
   findLineNumbers(const PDBSymbolCompiland &Compiland,<br>
<br>
Modified: llvm/trunk/lib/DebugInfo/PDB/<wbr>DIA/DIASession.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/DIA/DIASession.cpp?rev=329724&r1=329723&r2=329724&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>DebugInfo/PDB/DIA/DIASession.<wbr>cpp?rev=329724&r1=329723&r2=<wbr>329724&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/DebugInfo/PDB/<wbr>DIA/DIASession.cpp (original)<br>
+++ llvm/trunk/lib/DebugInfo/PDB/<wbr>DIA/DIASession.cpp Tue Apr 10 10:33:18 2018<br>
@@ -106,7 +106,7 @@ Error DIASession::createFromPdb(<wbr>StringRe<br>
   if (!llvm::<wbr>convertUTF8ToUTF16String(Path, Path16))<br>
     return make_error<GenericError>(<wbr>generic_error_code::invalid_<wbr>path);<br>
<br>
-  const wchar_t *Path16Str = reinterpret_cast<const wchar_t*>(Path16.data());<br>
+  const wchar_t *Path16Str = reinterpret_cast<const wchar_t *>(Path16.data());<br>
   HRESULT HR;<br>
   if (FAILED(HR = DiaDataSource-><wbr>loadDataFromPdb(Path16Str))) {<br>
     return ErrorFromHResult(HR, "Calling loadDataFromPdb {0}", Path);<br>
@@ -214,6 +214,31 @@ DIASession::<wbr>findSymbolByAddress(uint64_t<br>
   return PDBSymbol::create(*this, std::move(RawSymbol));<br>
 }<br>
<br>
+std::unique_ptr<PDBSymbol> DIASession::findSymbolByRVA(<wbr>uint32_t RVA,<br>
+                                                       PDB_SymType Type) const {<br>
+  enum SymTagEnum EnumVal = static_cast<enum SymTagEnum>(Type);<br>
+<br>
+  CComPtr<IDiaSymbol> Symbol;<br>
+  if (S_OK != Session->findSymbolByRVA(RVA, EnumVal, &Symbol))<br>
+    return nullptr;<br>
+<br>
+  auto RawSymbol = llvm::make_unique<<wbr>DIARawSymbol>(*this, Symbol);<br>
+  return PDBSymbol::create(*this, std::move(RawSymbol));<br>
+}<br>
+<br>
+std::unique_ptr<PDBSymbol><br>
+DIASession::<wbr>findSymbolBySectOffset(uint32_<wbr>t Sect, uint32_t Offset,<br>
+                                   PDB_SymType Type) const {<br>
+  enum SymTagEnum EnumVal = static_cast<enum SymTagEnum>(Type);<br>
+<br>
+  CComPtr<IDiaSymbol> Symbol;<br>
+  if (S_OK != Session->findSymbolByAddr(<wbr>Sect, Offset, EnumVal, &Symbol))<br>
+    return nullptr;<br>
+<br>
+  auto RawSymbol = llvm::make_unique<<wbr>DIARawSymbol>(*this, Symbol);<br>
+  return PDBSymbol::create(*this, std::move(RawSymbol));<br>
+}<br>
+<br>
 std::unique_ptr<<wbr>IPDBEnumLineNumbers><br>
 DIASession::findLineNumbers(<wbr>const PDBSymbolCompiland &Compiland,<br>
                             const IPDBSourceFile &File) const {<br>
@@ -222,9 +247,8 @@ DIASession::findLineNumbers(<wbr>const PDBSym<br>
   const DIASourceFile &RawFile = static_cast<const DIASourceFile &>(File);<br>
<br>
   CComPtr<IDiaEnumLineNumbers> LineNumbers;<br>
-  if (S_OK !=<br>
-      Session->findLines(<wbr>RawCompiland.getDiaSymbol(), RawFile.getDiaFile(),<br>
-                         &LineNumbers))<br>
+  if (S_OK != Session->findLines(<wbr>RawCompiland.getDiaSymbol(),<br>
+                                 RawFile.getDiaFile(), &LineNumbers))<br>
     return nullptr;<br>
<br>
   return llvm::make_unique<<wbr>DIAEnumLineNumbers>(<wbr>LineNumbers);<br>
@@ -359,9 +383,7 @@ std::unique_ptr<<wbr>IPDBEnumTables> DIASessi<br>
   return llvm::make_unique<<wbr>DIAEnumTables>(DiaEnumerator);<br>
 }<br>
<br>
-template <class T><br>
-static CComPtr<T><br>
-getTableEnumerator(<wbr>IDiaSession &Session) {<br>
+template <class T> static CComPtr<T> getTableEnumerator(IDiaSession &Session) {<br>
   CComPtr<T> Enumerator;<br>
   CComPtr<IDiaEnumTables> ET;<br>
   CComPtr<IDiaTable> Table;<br>
@@ -372,8 +394,7 @@ getTableEnumerator(IDiaSession &Session)<br>
<br>
   while (ET->Next(1, &Table, &Count) == S_OK && Count == 1) {<br>
     // There is only one table that matches the given iid<br>
-    if (S_OK ==<br>
-        Table->QueryInterface(__<wbr>uuidof(T), (void **)&Enumerator))<br>
+    if (S_OK == Table->QueryInterface(__<wbr>uuidof(T), (void **)&Enumerator))<br>
       break;<br>
     Table.Release();<br>
   }<br>
<br>
Modified: llvm/trunk/lib/DebugInfo/PDB/<wbr>Native/NativeSession.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/NativeSession.cpp?rev=329724&r1=329723&r2=329724&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>DebugInfo/PDB/Native/<wbr>NativeSession.cpp?rev=329724&<wbr>r1=329723&r2=329724&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/DebugInfo/PDB/<wbr>Native/NativeSession.cpp (original)<br>
+++ llvm/trunk/lib/DebugInfo/PDB/<wbr>Native/NativeSession.cpp Tue Apr 10 10:33:18 2018<br>
@@ -200,6 +200,17 @@ NativeSession::<wbr>findSymbolByAddress(uint6<br>
   return nullptr;<br>
 }<br>
<br>
+std::unique_ptr<PDBSymbol><br>
+NativeSession::<wbr>findSymbolByRVA(uint32_t RVA, PDB_SymType Type) const {<br>
+  return nullptr;<br>
+}<br>
+<br>
+std::unique_ptr<PDBSymbol><br>
+NativeSession::<wbr>findSymbolBySectOffset(uint32_<wbr>t Sect, uint32_t Offset,<br>
+                                      PDB_SymType Type) const {<br>
+  return nullptr;<br>
+}<br>
+<br>
 std::unique_ptr<<wbr>IPDBEnumLineNumbers><br>
 NativeSession::<wbr>findLineNumbers(const PDBSymbolCompiland &Compiland,<br>
                                const IPDBSourceFile &File) const {<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>