[pecoff] Implement ObjectFilePECOFF::GetDependedModules()

Summary:
This parses entries in pecoff import tables for imported DLLs and
is intended as the first step to allow LLDB to load a PE's shared
modules when creating a target on the LLDB console. 


Reviewers: rnk, zturner, aleksandr.urakov, lldb-commits, labath, asmith

Reviewed By: labath, asmith

Subscribers: labath, lemo, clayborg, Hui, mgorny, mgrang, teemperor

Differential Revision: https://reviews.llvm.org/D53094

llvm-svn: 348527
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
index ec2487b..f93b831 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
@@ -13,6 +13,7 @@
 #include <vector>
 
 #include "lldb/Symbol/ObjectFile.h"
+#include "llvm/Object/Binary.h"
 
 class ObjectFilePECOFF : public lldb_private::ObjectFile {
 public:
@@ -257,6 +258,8 @@
   bool ParseCOFFOptionalHeader(lldb::offset_t *offset_ptr);
   bool ParseSectionHeaders(uint32_t offset);
 
+  uint32_t ParseDependentModules();
+
   static void DumpDOSHeader(lldb_private::Stream *s,
                             const dos_header_t &header);
   static void DumpCOFFHeader(lldb_private::Stream *s,
@@ -265,6 +268,8 @@
                                 const coff_opt_header_t &header);
   void DumpSectionHeaders(lldb_private::Stream *s);
   void DumpSectionHeader(lldb_private::Stream *s, const section_header_t &sh);
+  void DumpDependentModules(lldb_private::Stream *s);
+
   bool GetSectionName(std::string &sect_name, const section_header_t &sect);
 
   typedef std::vector<section_header_t> SectionHeaderColl;
@@ -272,12 +277,18 @@
   typedef SectionHeaderColl::const_iterator SectionHeaderCollConstIter;
 
 private:
+  bool CreateBinary();
+
+private:
   dos_header_t m_dos_header;
   coff_header_t m_coff_header;
   coff_opt_header_t m_coff_header_opt;
   SectionHeaderColl m_sect_headers;
   lldb::addr_t m_image_base;
   lldb_private::Address m_entry_point_address;
+  llvm::Optional<lldb_private::FileSpecList> m_deps_filespec;
+  typedef llvm::object::OwningBinary<llvm::object::Binary> OWNBINType;
+  llvm::Optional<OWNBINType> m_owningbin;
 };
 
 #endif // liblldb_ObjectFilePECOFF_h_