[llvm] r329724 - [DebugInfoPDB] Add DIA implementations of findSymbolByRVA and findSymbolByAddr

Aaron Smith via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 10 11:06:35 PDT 2018


I’m fixing it on Linux right now.

From: Craig Topper <craig.topper at gmail.com>
Date: Tuesday, April 10, 2018 at 7:04 PM
To: Aaron Smith <aaron.smith at microsoft.com>
Cc: llvm-commits <llvm-commits at lists.llvm.org>
Subject: Re: [llvm] r329724 - [DebugInfoPDB] Add DIA implementations of findSymbolByRVA and findSymbolByAddr

I think this broke the build of one of the unit tests.

unittests/DebugInfo/PDB/PDBApiTest.cpp:398:23: error: allocating an object of abstract class type '(anonymous namespace)::MockSession'
                      ^
include/llvm/DebugInfo/PDB/IPDBSession.h:48:3: note: unimplemented pure virtual method 'findSymbolByRVA' in 'MockSession'
  findSymbolByRVA(uint32_t RVA, PDB_SymType Type) const = 0;
  ^
include/llvm/DebugInfo/PDB/IPDBSession.h:50:3: note: unimplemented pure virtual method 'findSymbolBySectOffset' in 'MockSession'
  findSymbolBySectOffset(uint32_t Sect, uint32_t Offset,

~Craig

On Tue, Apr 10, 2018 at 10:33 AM, Aaron Smith via llvm-commits <llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>> wrote:
Author: asmith
Date: Tue Apr 10 10:33:18 2018
New Revision: 329724

URL: http://llvm.org/viewvc/llvm-project?rev=329724&view=rev<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fllvm.org%2Fviewvc%2Fllvm-project%3Frev%3D329724%26view%3Drev&data=02%7C01%7Caaron.smith%40microsoft.com%7C4e2e7c441180421c28b608d59f0d7943%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636589802584503259&sdata=nezSqjAScTRjFRwJkFq1xhKLEkKehUB1yuzy1UC9cls%3D&reserved=0>
Log:
[DebugInfoPDB] Add DIA implementations of findSymbolByRVA and findSymbolByAddr

Modified:
    llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIASession.h
    llvm/trunk/include/llvm/DebugInfo/PDB/IPDBSession.h
    llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeSession.h
    llvm/trunk/lib/DebugInfo/PDB/DIA/DIASession.cpp
    llvm/trunk/lib/DebugInfo/PDB/Native/NativeSession.cpp

Modified: llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIASession.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIASession.h?rev=329724&r1=329723&r2=329724&view=diff<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fllvm.org%2Fviewvc%2Fllvm-project%2Fllvm%2Ftrunk%2Finclude%2Fllvm%2FDebugInfo%2FPDB%2FDIA%2FDIASession.h%3Frev%3D329724%26r1%3D329723%26r2%3D329724%26view%3Ddiff&data=02%7C01%7Caaron.smith%40microsoft.com%7C4e2e7c441180421c28b608d59f0d7943%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636589802584513263&sdata=40ayte3BdWPojuqyZ4%2FWeKXkRHsluOiHzMH3lKQ24UA%3D&reserved=0>
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIASession.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIASession.h Tue Apr 10 10:33:18 2018
@@ -41,6 +41,11 @@ public:

   std::unique_ptr<PDBSymbol>
   findSymbolByAddress(uint64_t Address, PDB_SymType Type) const override;
+  std::unique_ptr<PDBSymbol> findSymbolByRVA(uint32_t RVA,
+                                             PDB_SymType Type) const override;
+  std::unique_ptr<PDBSymbol>
+  findSymbolBySectOffset(uint32_t Section, uint32_t Offset,
+                         PDB_SymType Type) const override;

   std::unique_ptr<IPDBEnumLineNumbers>
   findLineNumbers(const PDBSymbolCompiland &Compiland,

Modified: llvm/trunk/include/llvm/DebugInfo/PDB/IPDBSession.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/IPDBSession.h?rev=329724&r1=329723&r2=329724&view=diff<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fllvm.org%2Fviewvc%2Fllvm-project%2Fllvm%2Ftrunk%2Finclude%2Fllvm%2FDebugInfo%2FPDB%2FIPDBSession.h%3Frev%3D329724%26r1%3D329723%26r2%3D329724%26view%3Ddiff&data=02%7C01%7Caaron.smith%40microsoft.com%7C4e2e7c441180421c28b608d59f0d7943%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636589802584513263&sdata=LQf0pJZVtKW6LMJ4i789RPdzxcxsDGND5bN%2FmsujIyI%3D&reserved=0>
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/IPDBSession.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/IPDBSession.h Tue Apr 10 10:33:18 2018
@@ -44,6 +44,11 @@ public:

   virtual std::unique_ptr<PDBSymbol>
   findSymbolByAddress(uint64_t Address, PDB_SymType Type) const = 0;
+  virtual std::unique_ptr<PDBSymbol>
+  findSymbolByRVA(uint32_t RVA, PDB_SymType Type) const = 0;
+  virtual std::unique_ptr<PDBSymbol>
+  findSymbolBySectOffset(uint32_t Sect, uint32_t Offset,
+                         PDB_SymType Type) const = 0;

   virtual std::unique_ptr<IPDBEnumLineNumbers>
   findLineNumbers(const PDBSymbolCompiland &Compiland,

Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeSession.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeSession.h?rev=329724&r1=329723&r2=329724&view=diff<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fllvm.org%2Fviewvc%2Fllvm-project%2Fllvm%2Ftrunk%2Finclude%2Fllvm%2FDebugInfo%2FPDB%2FNative%2FNativeSession.h%3Frev%3D329724%26r1%3D329723%26r2%3D329724%26view%3Ddiff&data=02%7C01%7Caaron.smith%40microsoft.com%7C4e2e7c441180421c28b608d59f0d7943%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636589802584523280&sdata=bCCHbcxGBekJ8D15q742mAMHXR%2BI8RY3hYYHo1%2B%2FhXE%3D&reserved=0>
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeSession.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeSession.h Tue Apr 10 10:33:18 2018
@@ -60,6 +60,11 @@ public:

   std::unique_ptr<PDBSymbol>
   findSymbolByAddress(uint64_t Address, PDB_SymType Type) const override;
+  std::unique_ptr<PDBSymbol> findSymbolByRVA(uint32_t RVA,
+                                             PDB_SymType Type) const override;
+  std::unique_ptr<PDBSymbol>
+  findSymbolBySectOffset(uint32_t Sect, uint32_t Offset,
+                         PDB_SymType Type) const override;

   std::unique_ptr<IPDBEnumLineNumbers>
   findLineNumbers(const PDBSymbolCompiland &Compiland,

Modified: llvm/trunk/lib/DebugInfo/PDB/DIA/DIASession.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/DIA/DIASession.cpp?rev=329724&r1=329723&r2=329724&view=diff<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fllvm.org%2Fviewvc%2Fllvm-project%2Fllvm%2Ftrunk%2Flib%2FDebugInfo%2FPDB%2FDIA%2FDIASession.cpp%3Frev%3D329724%26r1%3D329723%26r2%3D329724%26view%3Ddiff&data=02%7C01%7Caaron.smith%40microsoft.com%7C4e2e7c441180421c28b608d59f0d7943%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636589802584523280&sdata=bW%2F%2F6G9dBXKK2DpPrRgZTxjExV5GNOABHjjTxIbjVpo%3D&reserved=0>
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/DIA/DIASession.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/DIA/DIASession.cpp Tue Apr 10 10:33:18 2018
@@ -106,7 +106,7 @@ Error DIASession::createFromPdb(StringRe
   if (!llvm::convertUTF8ToUTF16String(Path, Path16))
     return make_error<GenericError>(generic_error_code::invalid_path);

-  const wchar_t *Path16Str = reinterpret_cast<const wchar_t*>(Path16.data());
+  const wchar_t *Path16Str = reinterpret_cast<const wchar_t *>(Path16.data());
   HRESULT HR;
   if (FAILED(HR = DiaDataSource->loadDataFromPdb(Path16Str))) {
     return ErrorFromHResult(HR, "Calling loadDataFromPdb {0}", Path);
@@ -214,6 +214,31 @@ DIASession::findSymbolByAddress(uint64_t
   return PDBSymbol::create(*this, std::move(RawSymbol));
 }

+std::unique_ptr<PDBSymbol> DIASession::findSymbolByRVA(uint32_t RVA,
+                                                       PDB_SymType Type) const {
+  enum SymTagEnum EnumVal = static_cast<enum SymTagEnum>(Type);
+
+  CComPtr<IDiaSymbol> Symbol;
+  if (S_OK != Session->findSymbolByRVA(RVA, EnumVal, &Symbol))
+    return nullptr;
+
+  auto RawSymbol = llvm::make_unique<DIARawSymbol>(*this, Symbol);
+  return PDBSymbol::create(*this, std::move(RawSymbol));
+}
+
+std::unique_ptr<PDBSymbol>
+DIASession::findSymbolBySectOffset(uint32_t Sect, uint32_t Offset,
+                                   PDB_SymType Type) const {
+  enum SymTagEnum EnumVal = static_cast<enum SymTagEnum>(Type);
+
+  CComPtr<IDiaSymbol> Symbol;
+  if (S_OK != Session->findSymbolByAddr(Sect, Offset, EnumVal, &Symbol))
+    return nullptr;
+
+  auto RawSymbol = llvm::make_unique<DIARawSymbol>(*this, Symbol);
+  return PDBSymbol::create(*this, std::move(RawSymbol));
+}
+
 std::unique_ptr<IPDBEnumLineNumbers>
 DIASession::findLineNumbers(const PDBSymbolCompiland &Compiland,
                             const IPDBSourceFile &File) const {
@@ -222,9 +247,8 @@ DIASession::findLineNumbers(const PDBSym
   const DIASourceFile &RawFile = static_cast<const DIASourceFile &>(File);

   CComPtr<IDiaEnumLineNumbers> LineNumbers;
-  if (S_OK !=
-      Session->findLines(RawCompiland.getDiaSymbol(), RawFile.getDiaFile(),
-                         &LineNumbers))
+  if (S_OK != Session->findLines(RawCompiland.getDiaSymbol(),
+                                 RawFile.getDiaFile(), &LineNumbers))
     return nullptr;

   return llvm::make_unique<DIAEnumLineNumbers>(LineNumbers);
@@ -359,9 +383,7 @@ std::unique_ptr<IPDBEnumTables> DIASessi
   return llvm::make_unique<DIAEnumTables>(DiaEnumerator);
 }

-template <class T>
-static CComPtr<T>
-getTableEnumerator(IDiaSession &Session) {
+template <class T> static CComPtr<T> getTableEnumerator(IDiaSession &Session) {
   CComPtr<T> Enumerator;
   CComPtr<IDiaEnumTables> ET;
   CComPtr<IDiaTable> Table;
@@ -372,8 +394,7 @@ getTableEnumerator(IDiaSession &Session)

   while (ET->Next(1, &Table, &Count) == S_OK && Count == 1) {
     // There is only one table that matches the given iid
-    if (S_OK ==
-        Table->QueryInterface(__uuidof(T), (void **)&Enumerator))
+    if (S_OK == Table->QueryInterface(__uuidof(T), (void **)&Enumerator))
       break;
     Table.Release();
   }

Modified: llvm/trunk/lib/DebugInfo/PDB/Native/NativeSession.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/NativeSession.cpp?rev=329724&r1=329723&r2=329724&view=diff<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fllvm.org%2Fviewvc%2Fllvm-project%2Fllvm%2Ftrunk%2Flib%2FDebugInfo%2FPDB%2FNative%2FNativeSession.cpp%3Frev%3D329724%26r1%3D329723%26r2%3D329724%26view%3Ddiff&data=02%7C01%7Caaron.smith%40microsoft.com%7C4e2e7c441180421c28b608d59f0d7943%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636589802584533284&sdata=5vQthxMojqm2CX9Kz8D0LPQgunkyh3nFh8jX4qOgBEA%3D&reserved=0>
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/NativeSession.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/NativeSession.cpp Tue Apr 10 10:33:18 2018
@@ -200,6 +200,17 @@ NativeSession::findSymbolByAddress(uint6
   return nullptr;
 }

+std::unique_ptr<PDBSymbol>
+NativeSession::findSymbolByRVA(uint32_t RVA, PDB_SymType Type) const {
+  return nullptr;
+}
+
+std::unique_ptr<PDBSymbol>
+NativeSession::findSymbolBySectOffset(uint32_t Sect, uint32_t Offset,
+                                      PDB_SymType Type) const {
+  return nullptr;
+}
+
 std::unique_ptr<IPDBEnumLineNumbers>
 NativeSession::findLineNumbers(const PDBSymbolCompiland &Compiland,
                                const IPDBSourceFile &File) const {


_______________________________________________
llvm-commits mailing list
llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.llvm.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fllvm-commits&data=02%7C01%7Caaron.smith%40microsoft.com%7C4e2e7c441180421c28b608d59f0d7943%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636589802584543288&sdata=xCJ32X5o4jW7Fr9F0Ggr8QyapStevobweR22F6Aumnc%3D&reserved=0>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180410/442429fd/attachment.html>


More information about the llvm-commits mailing list