[llvm] r328178 - [DIA] Add IPDBSectionContrib interfaces and DIA implementation

Aaron Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 21 21:08:15 PDT 2018


Author: asmith
Date: Wed Mar 21 21:08:15 2018
New Revision: 328178

URL: http://llvm.org/viewvc/llvm-project?rev=328178&view=rev
Log:
[DIA] Add IPDBSectionContrib interfaces and DIA implementation

To resolve symbol context at a particular address, we need to
determine the compiland for the address. We are able to determine
the parent compiland of PDBSymbolFunc, PDBSymbolTypeUDT,
PDBSymbolTypeEnum symbols indirectly through line information. 
However no such information is availabile for PDBSymbolData, 
i.e. variables.

The Section Contribution table from PDBs has information about
each compiland's contribution to sections by address. For example,
a piece of a contribution looks like,

  VA         RelativeVA  Sect No.  Offset    Length    Compiland
  14000087B0 000087B0    0001      000077B0  000000BB  exe_main.obj

So given an address, it's possible to determine its compiland with
this information.


Added:
    llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIAEnumSectionContribs.h
    llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIASectionContrib.h
    llvm/trunk/include/llvm/DebugInfo/PDB/IPDBSectionContrib.h
    llvm/trunk/lib/DebugInfo/PDB/DIA/DIAEnumSectionContribs.cpp
    llvm/trunk/lib/DebugInfo/PDB/DIA/DIASectionContrib.cpp
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/include/llvm/DebugInfo/PDB/PDBTypes.h
    llvm/trunk/include/llvm/module.modulemap
    llvm/trunk/lib/DebugInfo/PDB/CMakeLists.txt
    llvm/trunk/lib/DebugInfo/PDB/DIA/DIASession.cpp
    llvm/trunk/lib/DebugInfo/PDB/Native/NativeSession.cpp
    llvm/trunk/lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp
    llvm/trunk/unittests/DebugInfo/PDB/PDBApiTest.cpp

Added: llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIAEnumSectionContribs.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIAEnumSectionContribs.h?rev=328178&view=auto
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIAEnumSectionContribs.h (added)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIAEnumSectionContribs.h Wed Mar 21 21:08:15 2018
@@ -0,0 +1,40 @@
+//==- DIAEnumSectionContribs.h --------------------------------- -*- C++ -*-==//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_DEBUGINFO_PDB_DIA_DIAENUMSECTIONCONTRIBS_H
+#define LLVM_DEBUGINFO_PDB_DIA_DIAENUMSECTIONCONTRIBS_H
+
+#include "DIASupport.h"
+#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
+#include "llvm/DebugInfo/PDB/IPDBSectionContrib.h"
+
+namespace llvm {
+namespace pdb {
+class DIASession;
+
+class DIAEnumSectionContribs : public IPDBEnumChildren<IPDBSectionContrib> {
+public:
+  explicit DIAEnumSectionContribs(
+      const DIASession &PDBSession,
+      CComPtr<IDiaEnumSectionContribs> DiaEnumerator);
+
+  uint32_t getChildCount() const override;
+  ChildTypePtr getChildAtIndex(uint32_t Index) const override;
+  ChildTypePtr getNext() override;
+  void reset() override;
+  DIAEnumSectionContribs *clone() const override;
+
+private:
+  const DIASession &Session;
+  CComPtr<IDiaEnumSectionContribs> Enumerator;
+};
+}
+}
+
+#endif // LLVM_DEBUGINFO_PDB_DIA_DIAENUMSECTIONCONTRIBS_H

Added: llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIASectionContrib.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIASectionContrib.h?rev=328178&view=auto
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIASectionContrib.h (added)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIASectionContrib.h Wed Mar 21 21:08:15 2018
@@ -0,0 +1,55 @@
+//===- DIASectionContrib.h - DIA Impl. of IPDBSectionContrib ------ C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_DEBUGINFO_PDB_DIA_DIASECTIONCONTRIB_H
+#define LLVM_DEBUGINFO_PDB_DIA_DIASECTIONCONTRIB_H
+
+#include "DIASupport.h"
+#include "llvm/DebugInfo/PDB/IPDBSectionContrib.h"
+
+namespace llvm {
+namespace pdb {
+class DIASession;
+
+class DIASectionContrib : public IPDBSectionContrib {
+public:
+  explicit DIASectionContrib(const DIASession &PDBSession,
+                             CComPtr<IDiaSectionContrib> DiaSection);
+
+  std::unique_ptr<PDBSymbolCompiland> getCompiland() const override;
+  uint32_t getAddressSection() const override;
+  uint32_t getAddressOffset() const override;
+  uint32_t getRelativeVirtualAddress() const override;
+  uint64_t getVirtualAddress() const override;
+  uint32_t getLength() const override;
+  bool isNotPaged() const override;
+  bool hasCode() const override;
+  bool hasCode16Bit() const override;
+  bool hasInitializedData() const override;
+  bool hasUninitializedData() const override;
+  bool isRemoved() const override;
+  bool hasComdat() const override;
+  bool isDiscardable() const override;
+  bool isNotCached() const override;
+  bool isShared() const override;
+  bool isExecutable() const override;
+  bool isReadable() const override;
+  bool isWritable() const override;
+  uint32_t getDataCrc32() const override;
+  uint32_t getRelocationsCrc32() const override;
+  uint32_t getCompilandId() const override;
+
+private:
+  const DIASession &Session;
+  CComPtr<IDiaSectionContrib> Section;
+};
+}
+}
+
+#endif // LLVM_DEBUGINFO_PDB_DIA_DIASECTIONCONTRIB_H

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=328178&r1=328177&r2=328178&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIASession.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIASession.h Wed Mar 21 21:08:15 2018
@@ -71,6 +71,8 @@ public:
 
   std::unique_ptr<IPDBEnumInjectedSources> getInjectedSources() const override;
 
+  std::unique_ptr<IPDBEnumSectionContribs> getSectionContribs() const override;
+
 private:
   CComPtr<IDiaSession> Session;
 };

Added: llvm/trunk/include/llvm/DebugInfo/PDB/IPDBSectionContrib.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/IPDBSectionContrib.h?rev=328178&view=auto
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/IPDBSectionContrib.h (added)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/IPDBSectionContrib.h Wed Mar 21 21:08:15 2018
@@ -0,0 +1,50 @@
+//==- IPDBSectionContrib.h - Interfaces for PDB SectionContribs --*- C++ -*-==//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_DEBUGINFO_PDB_IPDBSECTIONCONTRIB_H
+#define LLVM_DEBUGINFO_PDB_IPDBSECTIONCONTRIB_H
+
+#include "PDBTypes.h"
+
+namespace llvm {
+namespace pdb {
+
+/// IPDBSectionContrib defines an interface used to represent section
+/// contributions whose information are stored in the PDB.
+class IPDBSectionContrib {
+public:
+  virtual ~IPDBSectionContrib();
+
+  virtual std::unique_ptr<PDBSymbolCompiland> getCompiland() const = 0;
+  virtual uint32_t getAddressSection() const = 0;
+  virtual uint32_t getAddressOffset() const = 0;
+  virtual uint32_t getRelativeVirtualAddress() const = 0;
+  virtual uint64_t getVirtualAddress() const  = 0;
+  virtual uint32_t getLength() const = 0;
+  virtual bool isNotPaged() const = 0;
+  virtual bool hasCode() const = 0;
+  virtual bool hasCode16Bit() const = 0;
+  virtual bool hasInitializedData() const = 0;
+  virtual bool hasUninitializedData() const = 0;
+  virtual bool isRemoved() const = 0;
+  virtual bool hasComdat() const = 0;
+  virtual bool isDiscardable() const = 0;
+  virtual bool isNotCached() const = 0;
+  virtual bool isShared() const = 0;
+  virtual bool isExecutable() const = 0;
+  virtual bool isReadable() const = 0;
+  virtual bool isWritable() const = 0;
+  virtual uint32_t getDataCrc32() const = 0;
+  virtual uint32_t getRelocationsCrc32() const = 0;
+  virtual uint32_t getCompilandId() const = 0;
+};
+}
+}
+
+#endif // LLVM_DEBUGINFO_PDB_IPDBSECTIONCONTRIB_H

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=328178&r1=328177&r2=328178&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/IPDBSession.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/IPDBSession.h Wed Mar 21 21:08:15 2018
@@ -75,6 +75,9 @@ public:
 
   virtual std::unique_ptr<IPDBEnumInjectedSources>
   getInjectedSources() const = 0;
+
+  virtual std::unique_ptr<IPDBEnumSectionContribs>
+  getSectionContribs() const = 0;
 };
 }
 }

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=328178&r1=328177&r2=328178&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeSession.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeSession.h Wed Mar 21 21:08:15 2018
@@ -90,6 +90,8 @@ public:
 
   std::unique_ptr<IPDBEnumInjectedSources> getInjectedSources() const override;
 
+  std::unique_ptr<IPDBEnumSectionContribs> getSectionContribs() const override;
+
   PDBFile &getPDBFile() { return *Pdb; }
   const PDBFile &getPDBFile() const { return *Pdb; }
 

Modified: llvm/trunk/include/llvm/DebugInfo/PDB/PDBTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/PDBTypes.h?rev=328178&r1=328177&r2=328178&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/PDBTypes.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/PDBTypes.h Wed Mar 21 21:08:15 2018
@@ -25,6 +25,7 @@ namespace pdb {
 class IPDBDataStream;
 class IPDBInjectedSource;
 class IPDBLineNumber;
+class IPDBSectionContrib;
 class IPDBSourceFile;
 class IPDBTable;
 class PDBSymDumper;
@@ -67,6 +68,7 @@ using IPDBEnumDataStreams = IPDBEnumChil
 using IPDBEnumLineNumbers = IPDBEnumChildren<IPDBLineNumber>;
 using IPDBEnumTables = IPDBEnumChildren<IPDBTable>;
 using IPDBEnumInjectedSources = IPDBEnumChildren<IPDBInjectedSource>;
+using IPDBEnumSectionContribs = IPDBEnumChildren<IPDBSectionContrib>;
 
 /// Specifies which PDB reader implementation is to be used.  Only a value
 /// of PDB_ReaderType::DIA is currently supported, but Native is in the works.

Modified: llvm/trunk/include/llvm/module.modulemap
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/module.modulemap?rev=328178&r1=328177&r2=328178&view=diff
==============================================================================
--- llvm/trunk/include/llvm/module.modulemap (original)
+++ llvm/trunk/include/llvm/module.modulemap Wed Mar 21 21:08:15 2018
@@ -93,12 +93,14 @@ module LLVM_DebugInfo_PDB {
   exclude header "DebugInfo/PDB/DIA/DIAEnumDebugStreams.h"
   exclude header "DebugInfo/PDB/DIA/DIAEnumInjectedSources.h"
   exclude header "DebugInfo/PDB/DIA/DIAEnumLineNumbers.h"
+  exclude header "DebugInfo/PDB/DIA/DIAEnumSectionContribs.h"
   exclude header "DebugInfo/PDB/DIA/DIAEnumSourceFiles.h"
   exclude header "DebugInfo/PDB/DIA/DIAEnumSymbols.h"
   exclude header "DebugInfo/PDB/DIA/DIAEnumTables.h"
   exclude header "DebugInfo/PDB/DIA/DIAInjectedSource.h"
   exclude header "DebugInfo/PDB/DIA/DIALineNumber.h"
   exclude header "DebugInfo/PDB/DIA/DIARawSymbol.h"
+  exclude header "DebugInfo/PDB/DIA/DIASectionContrib.h"
   exclude header "DebugInfo/PDB/DIA/DIASession.h"
   exclude header "DebugInfo/PDB/DIA/DIASourceFile.h"
   exclude header "DebugInfo/PDB/DIA/DIASupport.h"

Modified: llvm/trunk/lib/DebugInfo/PDB/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/CMakeLists.txt?rev=328178&r1=328177&r2=328178&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/CMakeLists.txt (original)
+++ llvm/trunk/lib/DebugInfo/PDB/CMakeLists.txt Wed Mar 21 21:08:15 2018
@@ -16,6 +16,7 @@ if(LLVM_ENABLE_DIA_SDK)
     DIA/DIAEnumDebugStreams.cpp
     DIA/DIAEnumInjectedSources.cpp
     DIA/DIAEnumLineNumbers.cpp
+    DIA/DIAEnumSectionContribs.cpp
     DIA/DIAEnumSourceFiles.cpp
     DIA/DIAEnumSymbols.cpp
     DIA/DIAEnumTables.cpp
@@ -23,6 +24,7 @@ if(LLVM_ENABLE_DIA_SDK)
     DIA/DIAInjectedSource.cpp
     DIA/DIALineNumber.cpp
     DIA/DIARawSymbol.cpp
+    DIA/DIASectionContrib.cpp
     DIA/DIASession.cpp
     DIA/DIASourceFile.cpp
     DIA/DIATable.cpp

Added: llvm/trunk/lib/DebugInfo/PDB/DIA/DIAEnumSectionContribs.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/DIA/DIAEnumSectionContribs.cpp?rev=328178&view=auto
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/DIA/DIAEnumSectionContribs.cpp (added)
+++ llvm/trunk/lib/DebugInfo/PDB/DIA/DIAEnumSectionContribs.cpp Wed Mar 21 21:08:15 2018
@@ -0,0 +1,54 @@
+//==- DIAEnumSectionContribs.cpp ---------------------------------*- C++ -*-==//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/DIA/DIAEnumSectionContribs.h"
+#include "llvm/DebugInfo/PDB/DIA/DIASectionContrib.h"
+#include "llvm/DebugInfo/PDB/DIA/DIASession.h"
+
+using namespace llvm;
+using namespace llvm::pdb;
+
+DIAEnumSectionContribs::DIAEnumSectionContribs(
+    const DIASession &PDBSession,
+    CComPtr<IDiaEnumSectionContribs> DiaEnumerator)
+    : Session(PDBSession), Enumerator(DiaEnumerator) {}
+
+uint32_t DIAEnumSectionContribs::getChildCount() const {
+  LONG Count = 0;
+  return (S_OK == Enumerator->get_Count(&Count)) ? Count : 0;
+}
+
+std::unique_ptr<IPDBSectionContrib>
+DIAEnumSectionContribs::getChildAtIndex(uint32_t Index) const {
+  CComPtr<IDiaSectionContrib> Item;
+  if (S_OK != Enumerator->Item(Index, &Item))
+    return nullptr;
+
+  return std::unique_ptr<IPDBSectionContrib>(
+      new DIASectionContrib(Session, Item));
+}
+
+std::unique_ptr<IPDBSectionContrib> DIAEnumSectionContribs::getNext() {
+  CComPtr<IDiaSectionContrib> Item;
+  ULONG NumFetched = 0;
+  if (S_OK != Enumerator->Next(1, &Item, &NumFetched))
+    return nullptr;
+
+  return std::unique_ptr<IPDBSectionContrib>(
+      new DIASectionContrib(Session, Item));
+}
+
+void DIAEnumSectionContribs::reset() { Enumerator->Reset(); }
+
+DIAEnumSectionContribs *DIAEnumSectionContribs::clone() const {
+  CComPtr<IDiaEnumSectionContribs> EnumeratorClone;
+  if (S_OK != Enumerator->Clone(&EnumeratorClone))
+    return nullptr;
+  return new DIAEnumSectionContribs(Session, EnumeratorClone);
+}

Added: llvm/trunk/lib/DebugInfo/PDB/DIA/DIASectionContrib.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/DIA/DIASectionContrib.cpp?rev=328178&view=auto
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/DIA/DIASectionContrib.cpp (added)
+++ llvm/trunk/lib/DebugInfo/PDB/DIA/DIASectionContrib.cpp Wed Mar 21 21:08:15 2018
@@ -0,0 +1,135 @@
+//===- DIASectionContrib.cpp - DIA impl. of IPDBSectionContrib ---- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/PDB/DIA/DIARawSymbol.h"
+#include "llvm/DebugInfo/PDB/DIA/DIASectionContrib.h"
+#include "llvm/DebugInfo/PDB/DIA/DIASession.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
+
+using namespace llvm;
+using namespace llvm::pdb;
+
+DIASectionContrib::DIASectionContrib(const DIASession &PDBSession,
+                                     CComPtr<IDiaSectionContrib> DiaSection)
+  : Session(PDBSession), Section(DiaSection) {}
+
+std::unique_ptr<PDBSymbolCompiland> DIASectionContrib::getCompiland() const {
+  CComPtr<IDiaSymbol> Symbol;
+  if (FAILED(Section->get_compiland(&Symbol)))
+    return nullptr;
+
+  auto RawSymbol = llvm::make_unique<DIARawSymbol>(Session, Symbol);
+  return llvm::make_unique<PDBSymbolCompiland>(Session, std::move(RawSymbol));
+}
+
+template <typename ArgType>
+ArgType PrivateGetDIAValue(
+    IDiaSectionContrib *Section,
+    HRESULT(__stdcall IDiaSectionContrib::*Method)(ArgType *)) {
+  ArgType Value;
+  if (S_OK == (Section->*Method)(&Value))
+    return static_cast<ArgType>(Value);
+
+  return ArgType();
+}
+
+template <typename ArgType, typename RetType>
+RetType PrivateGetDIAValue(
+    IDiaSectionContrib *Section,
+    HRESULT(__stdcall IDiaSectionContrib::*Method)(ArgType *)) {
+  ArgType Value;
+  if (S_OK == (Section->*Method)(&Value))
+    return static_cast<RetType>(Value);
+
+  return RetType();
+}
+
+uint32_t DIASectionContrib::getAddressSection() const {
+  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_addressSection);
+}
+
+uint32_t DIASectionContrib::getAddressOffset() const {
+  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_addressOffset);
+}
+
+uint64_t DIASectionContrib::getVirtualAddress() const {
+  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_virtualAddress);
+}
+
+uint32_t DIASectionContrib::getRelativeVirtualAddress() const {
+  return PrivateGetDIAValue(Section,
+                            &IDiaSectionContrib::get_relativeVirtualAddress);
+}
+uint32_t DIASectionContrib::getLength() const {
+  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_length);
+}
+
+bool DIASectionContrib::isNotPaged() const {
+  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_notPaged);
+}
+
+bool DIASectionContrib::hasCode() const {
+  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_code);
+}
+
+bool DIASectionContrib::hasCode16Bit() const {
+  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_code16bit);
+}
+
+bool DIASectionContrib::hasInitializedData() const {
+  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_initializedData);
+}
+
+bool DIASectionContrib::hasUninitializedData() const {
+  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_uninitializedData);
+}
+
+bool DIASectionContrib::isRemoved() const {
+  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_remove);
+}
+
+bool DIASectionContrib::hasComdat() const {
+  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_comdat);
+}
+
+bool DIASectionContrib::isDiscardable() const {
+  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_discardable);
+}
+
+bool DIASectionContrib::isNotCached() const {
+  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_notCached);
+}
+
+bool DIASectionContrib::isShared() const {
+  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_share);
+}
+
+bool DIASectionContrib::isExecutable() const {
+  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_execute);
+}
+
+bool DIASectionContrib::isReadable() const {
+  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_read);
+}
+
+bool DIASectionContrib::isWritable() const {
+  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_write);
+}
+
+uint32_t DIASectionContrib::getDataCrc32() const {
+  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_dataCrc);
+}
+
+uint32_t DIASectionContrib::getRelocationsCrc32() const {
+  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_relocationsCrc);
+}
+
+uint32_t DIASectionContrib::getCompilandId() const {
+  return PrivateGetDIAValue(Section, &IDiaSectionContrib::get_compilandId);
+}

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=328178&r1=328177&r2=328178&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/DIA/DIASession.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/DIA/DIASession.cpp Wed Mar 21 21:08:15 2018
@@ -11,6 +11,7 @@
 #include "llvm/DebugInfo/PDB/DIA/DIAEnumDebugStreams.h"
 #include "llvm/DebugInfo/PDB/DIA/DIAEnumInjectedSources.h"
 #include "llvm/DebugInfo/PDB/DIA/DIAEnumLineNumbers.h"
+#include "llvm/DebugInfo/PDB/DIA/DIAEnumSectionContribs.h"
 #include "llvm/DebugInfo/PDB/DIA/DIAEnumSourceFiles.h"
 #include "llvm/DebugInfo/PDB/DIA/DIAEnumTables.h"
 #include "llvm/DebugInfo/PDB/DIA/DIAError.h"
@@ -356,3 +357,13 @@ DIASession::getInjectedSources() const {
 
   return llvm::make_unique<DIAEnumInjectedSources>(*this, Files);
 }
+
+std::unique_ptr<IPDBEnumSectionContribs>
+DIASession::getSectionContribs() const {
+  CComPtr<IDiaEnumSectionContribs> Sections =
+      getTableEnumerator<IDiaEnumSectionContribs>(*Session);
+  if (!Sections)
+    return nullptr;
+
+  return llvm::make_unique<DIAEnumSectionContribs>(*this, Sections);
+}

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=328178&r1=328177&r2=328178&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/NativeSession.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/NativeSession.cpp Wed Mar 21 21:08:15 2018
@@ -260,3 +260,8 @@ std::unique_ptr<IPDBEnumInjectedSources>
 NativeSession::getInjectedSources() const {
   return nullptr;
 }
+
+std::unique_ptr<IPDBEnumSectionContribs>
+NativeSession::getSectionContribs() const {
+  return nullptr;
+}

Modified: llvm/trunk/lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp?rev=328178&r1=328177&r2=328178&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/PDBInterfaceAnchors.cpp Wed Mar 21 21:08:15 2018
@@ -15,6 +15,7 @@
 #include "llvm/DebugInfo/PDB/IPDBInjectedSource.h"
 #include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
 #include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
+#include "llvm/DebugInfo/PDB/IPDBSectionContrib.h"
 #include "llvm/DebugInfo/PDB/IPDBSession.h"
 #include "llvm/DebugInfo/PDB/IPDBTable.h"
 
@@ -32,3 +33,5 @@ IPDBLineNumber::~IPDBLineNumber() = defa
 IPDBTable::~IPDBTable() = default;
 
 IPDBInjectedSource::~IPDBInjectedSource() = default;
+
+IPDBSectionContrib::~IPDBSectionContrib() = default;

Modified: llvm/trunk/unittests/DebugInfo/PDB/PDBApiTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/DebugInfo/PDB/PDBApiTest.cpp?rev=328178&r1=328177&r2=328178&view=diff
==============================================================================
--- llvm/trunk/unittests/DebugInfo/PDB/PDBApiTest.cpp (original)
+++ llvm/trunk/unittests/DebugInfo/PDB/PDBApiTest.cpp Wed Mar 21 21:08:15 2018
@@ -14,6 +14,7 @@
 #include "llvm/DebugInfo/PDB/IPDBInjectedSource.h"
 #include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
 #include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
+#include "llvm/DebugInfo/PDB/IPDBSectionContrib.h"
 #include "llvm/DebugInfo/PDB/IPDBSession.h"
 #include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
 #include "llvm/DebugInfo/PDB/IPDBTable.h"
@@ -134,6 +135,10 @@ class MockSession : public IPDBSession {
   std::unique_ptr<IPDBEnumInjectedSources> getInjectedSources() const override {
     return nullptr;
   }
+
+  std::unique_ptr<IPDBEnumSectionContribs> getSectionContribs() const override {
+    return nullptr;
+  }
 };
 
 class MockRawSymbol : public IPDBRawSymbol {




More information about the llvm-commits mailing list