[llvm] r268072 - Put PDB parsing code into a pdb namespace.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 29 10:28:48 PDT 2016
Author: zturner
Date: Fri Apr 29 12:28:47 2016
New Revision: 268072
URL: http://llvm.org/viewvc/llvm-project?rev=268072&view=rev
Log:
Put PDB parsing code into a pdb namespace.
Added:
llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DbiStream.h
- copied, changed from r268071, llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBDbiStream.h
llvm/trunk/include/llvm/DebugInfo/PDB/Raw/InfoStream.h
- copied, changed from r268071, llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBInfoStream.h
llvm/trunk/include/llvm/DebugInfo/PDB/Raw/NameMap.h
- copied, changed from r268071, llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBNameMap.h
llvm/trunk/include/llvm/DebugInfo/PDB/Raw/RawConstants.h
- copied, changed from r268071, llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBRawConstants.h
llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStream.cpp
- copied, changed from r268071, llvm/trunk/lib/DebugInfo/PDB/Raw/PDBDbiStream.cpp
llvm/trunk/lib/DebugInfo/PDB/Raw/InfoStream.cpp
- copied, changed from r268071, llvm/trunk/lib/DebugInfo/PDB/Raw/PDBInfoStream.cpp
llvm/trunk/lib/DebugInfo/PDB/Raw/NameMap.cpp
- copied, changed from r268071, llvm/trunk/lib/DebugInfo/PDB/Raw/PDBNameMap.cpp
Removed:
llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBDbiStream.h
llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBInfoStream.h
llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBNameMap.h
llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBRawConstants.h
llvm/trunk/lib/DebugInfo/PDB/Raw/PDBDbiStream.cpp
llvm/trunk/lib/DebugInfo/PDB/Raw/PDBInfoStream.cpp
llvm/trunk/lib/DebugInfo/PDB/Raw/PDBNameMap.cpp
Modified:
llvm/trunk/include/llvm/DebugInfo/PDB/Raw/ByteStream.h
llvm/trunk/include/llvm/DebugInfo/PDB/Raw/MappedBlockStream.h
llvm/trunk/include/llvm/DebugInfo/PDB/Raw/ModInfo.h
llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBFile.h
llvm/trunk/include/llvm/DebugInfo/PDB/Raw/RawSession.h
llvm/trunk/include/llvm/DebugInfo/PDB/Raw/StreamInterface.h
llvm/trunk/include/llvm/DebugInfo/PDB/Raw/StreamReader.h
llvm/trunk/lib/DebugInfo/PDB/CMakeLists.txt
llvm/trunk/lib/DebugInfo/PDB/PDB.cpp
llvm/trunk/lib/DebugInfo/PDB/Raw/ByteStream.cpp
llvm/trunk/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp
llvm/trunk/lib/DebugInfo/PDB/Raw/ModInfo.cpp
llvm/trunk/lib/DebugInfo/PDB/Raw/PDBFile.cpp
llvm/trunk/lib/DebugInfo/PDB/Raw/RawSession.cpp
llvm/trunk/lib/DebugInfo/PDB/Raw/StreamReader.cpp
llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/ByteStream.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/ByteStream.h?rev=268072&r1=268071&r2=268072&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/ByteStream.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/ByteStream.h Fri Apr 29 12:28:47 2016
@@ -19,6 +19,7 @@
#include <vector>
namespace llvm {
+namespace pdb {
class StreamReader;
class ByteStream : public StreamInterface {
public:
@@ -43,5 +44,6 @@ private:
bool Owned;
};
}
+}
#endif
Copied: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DbiStream.h (from r268071, llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBDbiStream.h)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DbiStream.h?p2=llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DbiStream.h&p1=llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBDbiStream.h&r1=268071&r2=268072&rev=268072&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBDbiStream.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/DbiStream.h Fri Apr 29 12:28:47 2016
@@ -1,4 +1,4 @@
-//===- PDBDbiStream.h - PDB Dbi Stream (Stream 3) Access --------*- C++ -*-===//
+//===- DbiStream.h - PDB Dbi Stream (Stream 3) Access -----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -14,18 +14,19 @@
#include "llvm/DebugInfo/PDB/Raw/ByteStream.h"
#include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
#include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
-#include "llvm/DebugInfo/PDB/Raw/PDBRawConstants.h"
+#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
#include "llvm/Support/Endian.h"
namespace llvm {
+namespace pdb {
class PDBFile;
-class PDBDbiStream {
+class DbiStream {
struct HeaderInfo;
public:
- PDBDbiStream(PDBFile &File);
- ~PDBDbiStream();
+ DbiStream(PDBFile &File);
+ ~DbiStream();
std::error_code reload();
PdbRaw_DbiVer getDbiVersion() const;
@@ -65,5 +66,6 @@ private:
std::unique_ptr<HeaderInfo> Header;
};
}
+}
#endif
Copied: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/InfoStream.h (from r268071, llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBInfoStream.h)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/InfoStream.h?p2=llvm/trunk/include/llvm/DebugInfo/PDB/Raw/InfoStream.h&p1=llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBInfoStream.h&r1=268071&r2=268072&rev=268072&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBInfoStream.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/InfoStream.h Fri Apr 29 12:28:47 2016
@@ -1,4 +1,4 @@
-//===- PDBInfoStream.h - PDB Info Stream (Stream 1) Access ------*- C++ -*-===//
+//===- InfoStream.h - PDB Info Stream (Stream 1) Access ---------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -13,16 +13,16 @@
#include "llvm/ADT/StringMap.h"
#include "llvm/DebugInfo/PDB/PDBTypes.h"
#include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
-#include "llvm/DebugInfo/PDB/Raw/PDBNameMap.h"
-#include "llvm/DebugInfo/PDB/Raw/PDBRawConstants.h"
+#include "llvm/DebugInfo/PDB/Raw/NameMap.h"
+#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
#include "llvm/Support/Endian.h"
namespace llvm {
-
-class PDBInfoStream {
+namespace pdb {
+class InfoStream {
public:
- PDBInfoStream(PDBFile &File);
+ InfoStream(PDBFile &File);
std::error_code reload();
@@ -57,8 +57,9 @@ private:
// universally unique.
PDB_UniqueId Guid;
- PDBNameMap NamedStreams;
+ NameMap NamedStreams;
};
}
+}
#endif
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/MappedBlockStream.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/MappedBlockStream.h?rev=268072&r1=268071&r2=268072&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/MappedBlockStream.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/MappedBlockStream.h Fri Apr 29 12:28:47 2016
@@ -18,6 +18,7 @@
#include <vector>
namespace llvm {
+namespace pdb {
class PDBFile;
class MappedBlockStream : public StreamInterface {
@@ -34,5 +35,6 @@ private:
const PDBFile &Pdb;
};
}
+}
#endif
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/ModInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/ModInfo.h?rev=268072&r1=268071&r2=268072&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/ModInfo.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/ModInfo.h Fri Apr 29 12:28:47 2016
@@ -16,8 +16,7 @@
#include <vector>
namespace llvm {
-class PDBFile;
-
+namespace pdb {
class ModInfo {
private:
struct FileLayout;
@@ -36,8 +35,8 @@ public:
uint32_t getSourceFileNameIndex() const;
uint32_t getPdbFilePathNameIndex() const;
- llvm::StringRef getModuleName() const;
- llvm::StringRef getObjFileName() const;
+ StringRef getModuleName() const;
+ StringRef getObjFileName() const;
private:
const FileLayout *Layout;
@@ -66,5 +65,6 @@ private:
const uint8_t *Bytes;
};
}
+}
#endif
Copied: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/NameMap.h (from r268071, llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBNameMap.h)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/NameMap.h?p2=llvm/trunk/include/llvm/DebugInfo/PDB/Raw/NameMap.h&p1=llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBNameMap.h&r1=268071&r2=268072&rev=268072&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBNameMap.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/NameMap.h Fri Apr 29 12:28:47 2016
@@ -1,4 +1,4 @@
-//===- PDBNameMap.h - PDB Name Map ------------------------------*- C++ -*-===//
+//===- NameMap.h - PDB Name Map ---------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -17,10 +17,11 @@
#include <utility>
namespace llvm {
+namespace pdb {
class StreamReader;
-class PDBNameMap {
+class NameMap {
public:
- PDBNameMap();
+ NameMap();
std::error_code load(StreamReader &Stream);
@@ -30,5 +31,6 @@ private:
StringMap<uint32_t> Mapping;
};
}
+}
#endif
\ No newline at end of file
Removed: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBDbiStream.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBDbiStream.h?rev=268071&view=auto
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBDbiStream.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBDbiStream.h (removed)
@@ -1,69 +0,0 @@
-//===- PDBDbiStream.h - PDB Dbi Stream (Stream 3) Access --------*- 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_RAW_PDBDBISTREAM_H
-#define LLVM_DEBUGINFO_PDB_RAW_PDBDBISTREAM_H
-
-#include "llvm/DebugInfo/PDB/PDBTypes.h"
-#include "llvm/DebugInfo/PDB/Raw/ByteStream.h"
-#include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
-#include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
-#include "llvm/DebugInfo/PDB/Raw/PDBRawConstants.h"
-#include "llvm/Support/Endian.h"
-
-namespace llvm {
-class PDBFile;
-
-class PDBDbiStream {
- struct HeaderInfo;
-
-public:
- PDBDbiStream(PDBFile &File);
- ~PDBDbiStream();
- std::error_code reload();
-
- PdbRaw_DbiVer getDbiVersion() const;
- uint32_t getAge() const;
-
- bool isIncrementallyLinked() const;
- bool hasCTypes() const;
- bool isStripped() const;
-
- uint16_t getBuildMajorVersion() const;
- uint16_t getBuildMinorVersion() const;
-
- uint32_t getPdbDllVersion() const;
-
- uint32_t getNumberOfSymbols() const;
-
- PDB_Machine getMachineType() const;
-
- ArrayRef<ModuleInfoEx> modules() const;
-
-private:
- std::error_code initializeFileInfo();
-
- PDBFile &Pdb;
- MappedBlockStream Stream;
-
- std::vector<ModuleInfoEx> ModuleInfos;
-
- ByteStream ModInfoSubstream;
- ByteStream SecContrSubstream;
- ByteStream SecMapSubstream;
- ByteStream FileInfoSubstream;
- ByteStream TypeServerMapSubstream;
- ByteStream ECSubstream;
- ByteStream DbgHeader;
-
- std::unique_ptr<HeaderInfo> Header;
-};
-}
-
-#endif
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBFile.h?rev=268072&r1=268071&r2=268072&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBFile.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBFile.h Fri Apr 29 12:28:47 2016
@@ -19,9 +19,10 @@
namespace llvm {
class MemoryBuffer;
+namespace pdb {
struct PDBFileContext;
-class PDBDbiStream;
-class PDBInfoStream;
+class DbiStream;
+class InfoStream;
class PDBFile {
public:
@@ -39,11 +40,11 @@ public:
uint32_t getNumStreams() const;
uint32_t getStreamByteSize(uint32_t StreamIndex) const;
- llvm::ArrayRef<uint32_t> getStreamBlockList(uint32_t StreamIndex) const;
+ ArrayRef<uint32_t> getStreamBlockList(uint32_t StreamIndex) const;
StringRef getBlockData(uint32_t BlockIndex, uint32_t NumBytes) const;
- llvm::ArrayRef<support::ulittle32_t> getDirectoryBlockArray();
+ ArrayRef<support::ulittle32_t> getDirectoryBlockArray();
std::error_code parseFileHeaders();
std::error_code parseStreamData();
@@ -56,14 +57,15 @@ public:
return BlockNumber * BlockSize;
}
- PDBInfoStream &getPDBInfoStream();
- PDBDbiStream &getPDBDbiStream();
+ InfoStream &getPDBInfoStream();
+ DbiStream &getPDBDbiStream();
private:
std::unique_ptr<PDBFileContext> Context;
- std::unique_ptr<PDBInfoStream> InfoStream;
- std::unique_ptr<PDBDbiStream> DbiStream;
+ std::unique_ptr<InfoStream> Info;
+ std::unique_ptr<DbiStream> Dbi;
};
}
+}
#endif
Removed: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBInfoStream.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBInfoStream.h?rev=268071&view=auto
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBInfoStream.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBInfoStream.h (removed)
@@ -1,64 +0,0 @@
-//===- PDBInfoStream.h - PDB Info Stream (Stream 1) Access ------*- 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_RAW_PDBINFOSTREAM_H
-#define LLVM_DEBUGINFO_PDB_RAW_PDBINFOSTREAM_H
-
-#include "llvm/ADT/StringMap.h"
-#include "llvm/DebugInfo/PDB/PDBTypes.h"
-#include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
-#include "llvm/DebugInfo/PDB/Raw/PDBNameMap.h"
-#include "llvm/DebugInfo/PDB/Raw/PDBRawConstants.h"
-
-#include "llvm/Support/Endian.h"
-
-namespace llvm {
-
-class PDBInfoStream {
-public:
- PDBInfoStream(PDBFile &File);
-
- std::error_code reload();
-
- PdbRaw_ImplVer getVersion() const;
- uint32_t getSignature() const;
- uint32_t getAge() const;
- PDB_UniqueId getGuid() const;
-
- uint32_t getNamedStreamIndex(llvm::StringRef Name) const;
-
- PDBFile &getFile() { return Pdb; }
-
-private:
- PDBFile &Pdb;
- MappedBlockStream Stream;
-
- // PDB file format version. We only support VC70. See the enumeration
- // `PdbRaw_ImplVer` for the other possible values.
- uint32_t Version;
-
- // A 32-bit signature unique across all PDBs. This is generated with
- // a call to time() when the PDB is written, but obviously this is not
- // universally unique.
- uint32_t Signature;
-
- // The number of times the PDB has been written. Might also be used to
- // ensure that the PDB matches the executable.
- uint32_t Age;
-
- // Due to the aforementioned limitations with `Signature`, this is a new
- // signature present on VC70 and higher PDBs which is guaranteed to be
- // universally unique.
- PDB_UniqueId Guid;
-
- PDBNameMap NamedStreams;
-};
-}
-
-#endif
Removed: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBNameMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBNameMap.h?rev=268071&view=auto
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBNameMap.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBNameMap.h (removed)
@@ -1,34 +0,0 @@
-//===- PDBNameMap.h - PDB Name Map ------------------------------*- 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_RAW_PDBNAMEMAP_H
-#define LLVM_DEBUGINFO_PDB_RAW_PDBNAMEMAP_H
-
-#include "llvm/ADT/StringMap.h"
-#include "llvm/ADT/StringRef.h"
-
-#include <stdint.h>
-#include <utility>
-
-namespace llvm {
-class StreamReader;
-class PDBNameMap {
-public:
- PDBNameMap();
-
- std::error_code load(StreamReader &Stream);
-
- bool tryGetValue(StringRef Name, uint32_t &Value) const;
-
-private:
- StringMap<uint32_t> Mapping;
-};
-}
-
-#endif
\ No newline at end of file
Removed: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBRawConstants.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBRawConstants.h?rev=268071&view=auto
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBRawConstants.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBRawConstants.h (removed)
@@ -1,39 +0,0 @@
-//===- PDBRawConstants.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_RAW_PDBRAWCONSTANTS_H
-#define LLVM_DEBUGINFO_PDB_RAW_PDBRAWCONSTANTS_H
-
-#include <stdint.h>
-
-namespace llvm {
-
-enum PdbRaw_ImplVer : uint32_t {
- PdbImplVC2 = 19941610,
- PdbImplVC4 = 19950623,
- PdbImplVC41 = 19950814,
- PdbImplVC50 = 19960307,
- PdbImplVC98 = 19970604,
- PdbImplVC70Dep = 19990604, // deprecated
- PdbImplVC70 = 20000404,
- PdbImplVC80 = 20030901,
- PdbImplVC110 = 20091201,
- PdbImplVC140 = 20140508,
-};
-
-enum PdbRaw_DbiVer : uint32_t {
- PdbDbiVC41 = 930803,
- PdbDbiV50 = 19960307,
- PdbDbiV60 = 19970606,
- PdbDbiV70 = 19990903,
- PdbDbiV110 = 20091201
-};
-}
-
-#endif
Copied: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/RawConstants.h (from r268071, llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBRawConstants.h)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/RawConstants.h?p2=llvm/trunk/include/llvm/DebugInfo/PDB/Raw/RawConstants.h&p1=llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBRawConstants.h&r1=268071&r2=268072&rev=268072&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/PDBRawConstants.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/RawConstants.h Fri Apr 29 12:28:47 2016
@@ -13,7 +13,7 @@
#include <stdint.h>
namespace llvm {
-
+namespace pdb {
enum PdbRaw_ImplVer : uint32_t {
PdbImplVC2 = 19941610,
PdbImplVC4 = 19950623,
@@ -35,5 +35,6 @@ enum PdbRaw_DbiVer : uint32_t {
PdbDbiV110 = 20091201
};
}
+}
#endif
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/RawSession.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/RawSession.h?rev=268072&r1=268071&r2=268072&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/RawSession.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/RawSession.h Fri Apr 29 12:28:47 2016
@@ -10,11 +10,12 @@
#ifndef LLVM_DEBUGINFO_PDB_RAW_RAWSESSION_H
#define LLVM_DEBUGINFO_PDB_RAW_RAWSESSION_H
+#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/PDB/IPDBSession.h"
namespace llvm {
+namespace pdb {
class PDBFile;
-class StringRef;
class RawSession : public IPDBSession {
public:
@@ -68,5 +69,6 @@ private:
std::unique_ptr<PDBFile> Pdb;
};
}
+}
#endif
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/StreamInterface.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/StreamInterface.h?rev=268072&r1=268071&r2=268072&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/StreamInterface.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/StreamInterface.h Fri Apr 29 12:28:47 2016
@@ -16,6 +16,7 @@
#include <system_error>
namespace llvm {
+namespace pdb {
class StreamInterface {
public:
virtual ~StreamInterface() {}
@@ -25,5 +26,6 @@ public:
virtual uint32_t getLength() const = 0;
};
}
+}
#endif
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/StreamReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/StreamReader.h?rev=268072&r1=268071&r2=268072&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/StreamReader.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/StreamReader.h Fri Apr 29 12:28:47 2016
@@ -10,6 +10,7 @@
#ifndef LLVM_DEBUGINFO_PDB_RAW_STREAMREADER_H
#define LLVM_DEBUGINFO_PDB_RAW_STREAMREADER_H
+#include "llvm/ADT/ArrayRef.h"
#include "llvm/DebugInfo/PDB/Raw/StreamInterface.h"
#include "llvm/Support/Endian.h"
@@ -17,7 +18,8 @@
#include <system_error>
namespace llvm {
-
+namespace pdb {
+class StreamInterface;
class StreamReader {
public:
StreamReader(const StreamInterface &S);
@@ -42,5 +44,6 @@ private:
uint32_t Offset;
};
}
+}
#endif
Modified: llvm/trunk/lib/DebugInfo/PDB/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/CMakeLists.txt?rev=268072&r1=268071&r2=268072&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/CMakeLists.txt (original)
+++ llvm/trunk/lib/DebugInfo/PDB/CMakeLists.txt Fri Apr 29 12:28:47 2016
@@ -31,9 +31,9 @@ add_pdb_impl_folder(Raw
Raw/MappedBlockStream.cpp
Raw/ModInfo.cpp
Raw/PDBFile.cpp
- Raw/PDBDbiStream.cpp
- Raw/PDBInfoStream.cpp
- Raw/PDBNameMap.cpp
+ Raw/DbiStream.cpp
+ Raw/InfoStream.cpp
+ Raw/NameMap.cpp
Raw/RawSession.cpp
Raw/StreamReader.cpp)
Modified: llvm/trunk/lib/DebugInfo/PDB/PDB.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/PDB.cpp?rev=268072&r1=268071&r2=268072&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/PDB.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/PDB.cpp Fri Apr 29 12:28:47 2016
@@ -25,7 +25,7 @@ PDB_ErrorCode llvm::loadDataForPDB(PDB_R
std::unique_ptr<IPDBSession> &Session) {
// Create the correct concrete instance type based on the value of Type.
if (Type == PDB_ReaderType::Raw)
- return RawSession::createFromPdb(Path, Session);
+ return pdb::RawSession::createFromPdb(Path, Session);
#if HAVE_DIA_SDK
return DIASession::createFromPdb(Path, Session);
@@ -38,7 +38,7 @@ PDB_ErrorCode llvm::loadDataForEXE(PDB_R
std::unique_ptr<IPDBSession> &Session) {
// Create the correct concrete instance type based on the value of Type.
if (Type == PDB_ReaderType::Raw)
- return RawSession::createFromExe(Path, Session);
+ return pdb::RawSession::createFromExe(Path, Session);
#if HAVE_DIA_SDK
return DIASession::createFromExe(Path, Session);
Modified: llvm/trunk/lib/DebugInfo/PDB/Raw/ByteStream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/ByteStream.cpp?rev=268072&r1=268071&r2=268072&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/ByteStream.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/ByteStream.cpp Fri Apr 29 12:28:47 2016
@@ -11,6 +11,7 @@
#include "llvm/DebugInfo/PDB/Raw/StreamReader.h"
using namespace llvm;
+using namespace llvm::pdb;
ByteStream::ByteStream() : Owned(false) {}
Copied: llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStream.cpp (from r268071, llvm/trunk/lib/DebugInfo/PDB/Raw/PDBDbiStream.cpp)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStream.cpp?p2=llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStream.cpp&p1=llvm/trunk/lib/DebugInfo/PDB/Raw/PDBDbiStream.cpp&r1=268071&r2=268072&rev=268072&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/PDBDbiStream.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/DbiStream.cpp Fri Apr 29 12:28:47 2016
@@ -1,4 +1,4 @@
-//===- PDBDbiStream.cpp - PDB Dbi Stream (Stream 3) Access ----------------===//
+//===- DbiStream.cpp - PDB Dbi Stream (Stream 3) Access -------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,14 +7,15 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/DebugInfo/PDB/Raw/PDBDbiStream.h"
+#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
+#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
#include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
-#include "llvm/DebugInfo/PDB/Raw/PDBInfoStream.h"
-#include "llvm/DebugInfo/PDB/Raw/PDBRawConstants.h"
+#include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
#include "llvm/DebugInfo/PDB/Raw/StreamReader.h"
using namespace llvm;
+using namespace llvm::pdb;
using namespace llvm::support;
namespace {
@@ -45,10 +46,10 @@ const uint16_t BuildMajorMask = 0x7F00;
const uint16_t BuildMajorShift = 8;
}
-struct PDBDbiStream::HeaderInfo {
+struct DbiStream::HeaderInfo {
little32_t VersionSignature;
ulittle32_t VersionHeader;
- ulittle32_t Age; // Should match PDBInfoStream.
+ ulittle32_t Age; // Should match InfoStream.
ulittle16_t GSSyms; // Number of global symbols
ulittle16_t BuildNumber; // See DbiBuildNo structure.
ulittle16_t PSSyms; // Number of public symbols
@@ -59,23 +60,23 @@ struct PDBDbiStream::HeaderInfo {
little32_t SecContrSubstreamSize; // Size of sec. contribution stream
little32_t SectionMapSize; // Size of sec. map substream
little32_t FileInfoSize; // Size of file info substream
- little32_t TypeServerSize; // Size of type server map
- ulittle32_t MFCTypeServerIndex; // Index of MFC Type Server
- little32_t OptionalDbgHdrSize; // Size of DbgHeader info
- little32_t ECSubstreamSize; // Size of EC stream (what is EC?)
- ulittle16_t Flags; // See DbiFlags enum.
- ulittle16_t MachineType; // See PDB_MachineType enum.
+ little32_t TypeServerSize; // Size of type server map
+ ulittle32_t MFCTypeServerIndex; // Index of MFC Type Server
+ little32_t OptionalDbgHdrSize; // Size of DbgHeader info
+ little32_t ECSubstreamSize; // Size of EC stream (what is EC?)
+ ulittle16_t Flags; // See DbiFlags enum.
+ ulittle16_t MachineType; // See PDB_MachineType enum.
ulittle32_t Reserved; // Pad to 64 bytes
};
-PDBDbiStream::PDBDbiStream(PDBFile &File) : Pdb(File), Stream(3, File) {
+DbiStream::DbiStream(PDBFile &File) : Pdb(File), Stream(3, File) {
static_assert(sizeof(HeaderInfo) == 64, "Invalid HeaderInfo size!");
}
-PDBDbiStream::~PDBDbiStream() {}
+DbiStream::~DbiStream() {}
-std::error_code PDBDbiStream::reload() {
+std::error_code DbiStream::reload() {
StreamReader Reader(Stream);
Header.reset(new HeaderInfo());
@@ -127,7 +128,8 @@ std::error_code PDBDbiStream::reload() {
for (auto Info : Range)
ModuleInfos.push_back(ModuleInfoEx(Info));
- if ((EC = SecContrSubstream.initialize(Reader, Header->SecContrSubstreamSize)))
+ if ((EC =
+ SecContrSubstream.initialize(Reader, Header->SecContrSubstreamSize)))
return EC;
if ((EC = SecMapSubstream.initialize(Reader, Header->SectionMapSize)))
return EC;
@@ -149,47 +151,45 @@ std::error_code PDBDbiStream::reload() {
return std::error_code();
}
-PdbRaw_DbiVer PDBDbiStream::getDbiVersion() const {
+PdbRaw_DbiVer DbiStream::getDbiVersion() const {
uint32_t Value = Header->VersionHeader;
return static_cast<PdbRaw_DbiVer>(Value);
}
-uint32_t PDBDbiStream::getAge() const { return Header->Age; }
+uint32_t DbiStream::getAge() const { return Header->Age; }
-bool PDBDbiStream::isIncrementallyLinked() const {
+bool DbiStream::isIncrementallyLinked() const {
return (Header->Flags & FlagIncrementalMask) != 0;
}
-bool PDBDbiStream::hasCTypes() const {
+bool DbiStream::hasCTypes() const {
return (Header->Flags & FlagHasCTypesMask) != 0;
}
-bool PDBDbiStream::isStripped() const {
+bool DbiStream::isStripped() const {
return (Header->Flags & FlagStrippedMask) != 0;
}
-uint16_t PDBDbiStream::getBuildMajorVersion() const {
+uint16_t DbiStream::getBuildMajorVersion() const {
return (Header->BuildNumber & BuildMajorMask) >> BuildMajorShift;
}
-uint16_t PDBDbiStream::getBuildMinorVersion() const {
+uint16_t DbiStream::getBuildMinorVersion() const {
return (Header->BuildNumber & BuildMinorMask) >> BuildMinorShift;
}
-uint32_t PDBDbiStream::getPdbDllVersion() const {
- return Header->PdbDllVersion;
-}
+uint32_t DbiStream::getPdbDllVersion() const { return Header->PdbDllVersion; }
-uint32_t PDBDbiStream::getNumberOfSymbols() const { return Header->SymRecords; }
+uint32_t DbiStream::getNumberOfSymbols() const { return Header->SymRecords; }
-PDB_Machine PDBDbiStream::getMachineType() const {
+PDB_Machine DbiStream::getMachineType() const {
uint16_t Machine = Header->MachineType;
return static_cast<PDB_Machine>(Machine);
}
-ArrayRef<ModuleInfoEx> PDBDbiStream::modules() const { return ModuleInfos; }
+ArrayRef<ModuleInfoEx> DbiStream::modules() const { return ModuleInfos; }
-std::error_code PDBDbiStream::initializeFileInfo() {
+std::error_code DbiStream::initializeFileInfo() {
struct FileInfoSubstreamHeader {
ulittle16_t NumModules; // Total # of modules, should match number of
// records in the ModuleInfo substream.
Copied: llvm/trunk/lib/DebugInfo/PDB/Raw/InfoStream.cpp (from r268071, llvm/trunk/lib/DebugInfo/PDB/Raw/PDBInfoStream.cpp)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/InfoStream.cpp?p2=llvm/trunk/lib/DebugInfo/PDB/Raw/InfoStream.cpp&p1=llvm/trunk/lib/DebugInfo/PDB/Raw/PDBInfoStream.cpp&r1=268071&r2=268072&rev=268072&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/PDBInfoStream.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/InfoStream.cpp Fri Apr 29 12:28:47 2016
@@ -1,4 +1,4 @@
-//===- PDBInfoStream.cpp - PDB Info Stream (Stream 1) Access ----*- C++ -*-===//
+//===- InfoStream.cpp - PDB Info Stream (Stream 1) Access -------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,16 +7,17 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/DebugInfo/PDB/Raw/PDBInfoStream.h"
+#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/DebugInfo/PDB/Raw/StreamReader.h"
using namespace llvm;
+using namespace llvm::pdb;
-PDBInfoStream::PDBInfoStream(PDBFile &File) : Pdb(File), Stream(1, File) {}
+InfoStream::InfoStream(PDBFile &File) : Pdb(File), Stream(1, File) {}
-std::error_code PDBInfoStream::reload() {
+std::error_code InfoStream::reload() {
StreamReader Reader(Stream);
support::ulittle32_t Value;
@@ -38,19 +39,19 @@ std::error_code PDBInfoStream::reload()
return std::error_code();
}
-uint32_t PDBInfoStream::getNamedStreamIndex(llvm::StringRef Name) const {
+uint32_t InfoStream::getNamedStreamIndex(llvm::StringRef Name) const {
uint32_t Result;
if (!NamedStreams.tryGetValue(Name, Result))
return 0;
return Result;
}
-PdbRaw_ImplVer PDBInfoStream::getVersion() const {
+PdbRaw_ImplVer InfoStream::getVersion() const {
return static_cast<PdbRaw_ImplVer>(Version);
}
-uint32_t PDBInfoStream::getSignature() const { return Signature; }
+uint32_t InfoStream::getSignature() const { return Signature; }
-uint32_t PDBInfoStream::getAge() const { return Age; }
+uint32_t InfoStream::getAge() const { return Age; }
-PDB_UniqueId PDBInfoStream::getGuid() const { return Guid; }
+PDB_UniqueId InfoStream::getGuid() const { return Guid; }
Modified: llvm/trunk/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp?rev=268072&r1=268071&r2=268072&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp Fri Apr 29 12:28:47 2016
@@ -11,6 +11,7 @@
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
using namespace llvm;
+using namespace llvm::pdb;
MappedBlockStream::MappedBlockStream(uint32_t StreamIdx, const PDBFile &File) : Pdb(File) {
StreamLength = Pdb.getStreamByteSize(StreamIdx);
Modified: llvm/trunk/lib/DebugInfo/PDB/Raw/ModInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/ModInfo.cpp?rev=268072&r1=268071&r2=268072&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/ModInfo.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/ModInfo.cpp Fri Apr 29 12:28:47 2016
@@ -12,6 +12,7 @@
#include "llvm/Support/Endian.h"
using namespace llvm;
+using namespace llvm::pdb;
using namespace llvm::support;
namespace {
Copied: llvm/trunk/lib/DebugInfo/PDB/Raw/NameMap.cpp (from r268071, llvm/trunk/lib/DebugInfo/PDB/Raw/PDBNameMap.cpp)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/NameMap.cpp?p2=llvm/trunk/lib/DebugInfo/PDB/Raw/NameMap.cpp&p1=llvm/trunk/lib/DebugInfo/PDB/Raw/PDBNameMap.cpp&r1=268071&r2=268072&rev=268072&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/PDBNameMap.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/NameMap.cpp Fri Apr 29 12:28:47 2016
@@ -1,4 +1,4 @@
-//===- PDBNameMap.cpp - PDB Name Map ----------------------------*- C++ -*-===//
+//===- NameMap.cpp - PDB Name Map -------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,15 +7,16 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/DebugInfo/PDB/Raw/PDBNameMap.h"
+#include "llvm/DebugInfo/PDB/Raw/NameMap.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/DebugInfo/PDB/Raw/StreamReader.h"
using namespace llvm;
+using namespace llvm::pdb;
-PDBNameMap::PDBNameMap() {}
+NameMap::NameMap() {}
-std::error_code PDBNameMap::load(StreamReader &Stream) {
+std::error_code NameMap::load(StreamReader &Stream) {
// This is some sort of weird string-set/hash table encoded in the stream.
// It starts with the number of bytes in the table.
@@ -100,7 +101,7 @@ std::error_code PDBNameMap::load(StreamR
return std::error_code();
}
-bool PDBNameMap::tryGetValue(StringRef Name, uint32_t &Value) const {
+bool NameMap::tryGetValue(StringRef Name, uint32_t &Value) const {
auto Iter = Mapping.find(Name);
if (Iter == Mapping.end())
return false;
Removed: llvm/trunk/lib/DebugInfo/PDB/Raw/PDBDbiStream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/PDBDbiStream.cpp?rev=268071&view=auto
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/PDBDbiStream.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/PDBDbiStream.cpp (removed)
@@ -1,267 +0,0 @@
-//===- PDBDbiStream.cpp - PDB Dbi Stream (Stream 3) Access ----------------===//
-//
-// 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/Raw/PDBDbiStream.h"
-#include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
-#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
-#include "llvm/DebugInfo/PDB/Raw/PDBInfoStream.h"
-#include "llvm/DebugInfo/PDB/Raw/PDBRawConstants.h"
-#include "llvm/DebugInfo/PDB/Raw/StreamReader.h"
-
-using namespace llvm;
-using namespace llvm::support;
-
-namespace {
-// Some of the values are stored in bitfields. Since this needs to be portable
-// across compilers and architectures (big / little endian in particular) we
-// can't use the actual structures below, but must instead do the shifting
-// and masking ourselves. The struct definitions are provided for reference.
-
-// struct DbiFlags {
-// uint16_t IncrementalLinking : 1; // True if linked incrementally
-// uint16_t IsStripped : 1; // True if private symbols were stripped.
-// uint16_t HasCTypes : 1; // True if linked with /debug:ctypes.
-// uint16_t Reserved : 13;
-//};
-const uint16_t FlagIncrementalMask = 0x0001;
-const uint16_t FlagStrippedMask = 0x0002;
-const uint16_t FlagHasCTypesMask = 0x0004;
-
-// struct DbiBuildNo {
-// uint16_t MinorVersion : 8;
-// uint16_t MajorVersion : 7;
-// uint16_t NewVersionFormat : 1;
-//};
-const uint16_t BuildMinorMask = 0x00FF;
-const uint16_t BuildMinorShift = 0;
-
-const uint16_t BuildMajorMask = 0x7F00;
-const uint16_t BuildMajorShift = 8;
-}
-
-struct PDBDbiStream::HeaderInfo {
- little32_t VersionSignature;
- ulittle32_t VersionHeader;
- ulittle32_t Age; // Should match PDBInfoStream.
- ulittle16_t GSSyms; // Number of global symbols
- ulittle16_t BuildNumber; // See DbiBuildNo structure.
- ulittle16_t PSSyms; // Number of public symbols
- ulittle16_t PdbDllVersion; // version of mspdbNNN.dll
- ulittle16_t SymRecords; // Number of symbols
- ulittle16_t PdbDllRbld; // rbld number of mspdbNNN.dll
- little32_t ModiSubstreamSize; // Size of module info stream
- little32_t SecContrSubstreamSize; // Size of sec. contribution stream
- little32_t SectionMapSize; // Size of sec. map substream
- little32_t FileInfoSize; // Size of file info substream
- little32_t TypeServerSize; // Size of type server map
- ulittle32_t MFCTypeServerIndex; // Index of MFC Type Server
- little32_t OptionalDbgHdrSize; // Size of DbgHeader info
- little32_t ECSubstreamSize; // Size of EC stream (what is EC?)
- ulittle16_t Flags; // See DbiFlags enum.
- ulittle16_t MachineType; // See PDB_MachineType enum.
-
- ulittle32_t Reserved; // Pad to 64 bytes
-};
-
-PDBDbiStream::PDBDbiStream(PDBFile &File) : Pdb(File), Stream(3, File) {
- static_assert(sizeof(HeaderInfo) == 64, "Invalid HeaderInfo size!");
-}
-
-PDBDbiStream::~PDBDbiStream() {}
-
-std::error_code PDBDbiStream::reload() {
- StreamReader Reader(Stream);
-
- Header.reset(new HeaderInfo());
-
- if (Stream.getLength() < sizeof(HeaderInfo))
- return std::make_error_code(std::errc::illegal_byte_sequence);
- Reader.readObject(Header.get());
-
- if (Header->VersionSignature != -1)
- return std::make_error_code(std::errc::illegal_byte_sequence);
-
- // Require at least version 7, which should be present in all PDBs
- // produced in the last decade and allows us to avoid having to
- // special case all kinds of complicated arcane formats.
- if (Header->VersionHeader < PdbDbiV70)
- return std::make_error_code(std::errc::not_supported);
-
- if (Header->Age != Pdb.getPDBInfoStream().getAge())
- return std::make_error_code(std::errc::illegal_byte_sequence);
-
- if (Stream.getLength() !=
- sizeof(HeaderInfo) + Header->ModiSubstreamSize +
- Header->SecContrSubstreamSize + Header->SectionMapSize +
- Header->FileInfoSize + Header->TypeServerSize +
- Header->OptionalDbgHdrSize + Header->ECSubstreamSize)
- return std::make_error_code(std::errc::illegal_byte_sequence);
-
- // Only certain substreams are guaranteed to be aligned. Validate
- // them here.
- if (Header->ModiSubstreamSize % sizeof(uint32_t) != 0)
- return std::make_error_code(std::errc::illegal_byte_sequence);
- if (Header->SecContrSubstreamSize % sizeof(uint32_t) != 0)
- return std::make_error_code(std::errc::illegal_byte_sequence);
- if (Header->SectionMapSize % sizeof(uint32_t) != 0)
- return std::make_error_code(std::errc::illegal_byte_sequence);
- if (Header->FileInfoSize % sizeof(uint32_t) != 0)
- return std::make_error_code(std::errc::illegal_byte_sequence);
- if (Header->TypeServerSize % sizeof(uint32_t) != 0)
- return std::make_error_code(std::errc::illegal_byte_sequence);
-
- std::error_code EC;
- ModInfoSubstream.initialize(Reader, Header->ModiSubstreamSize);
-
- // Since each ModInfo in the stream is a variable length, we have to iterate
- // them to know how many there actually are.
- auto Range =
- llvm::make_range(ModInfoIterator(&ModInfoSubstream.data().front()),
- ModInfoIterator(&ModInfoSubstream.data().back() + 1));
- for (auto Info : Range)
- ModuleInfos.push_back(ModuleInfoEx(Info));
-
- if ((EC = SecContrSubstream.initialize(Reader, Header->SecContrSubstreamSize)))
- return EC;
- if ((EC = SecMapSubstream.initialize(Reader, Header->SectionMapSize)))
- return EC;
- if ((EC = FileInfoSubstream.initialize(Reader, Header->FileInfoSize)))
- return EC;
- if ((EC = TypeServerMapSubstream.initialize(Reader, Header->TypeServerSize)))
- return EC;
- if ((EC = ECSubstream.initialize(Reader, Header->ECSubstreamSize)))
- return EC;
- if ((EC = DbgHeader.initialize(Reader, Header->OptionalDbgHdrSize)))
- return EC;
-
- if ((EC = initializeFileInfo()))
- return EC;
-
- if (Reader.bytesRemaining() > 0)
- return std::make_error_code(std::errc::illegal_byte_sequence);
-
- return std::error_code();
-}
-
-PdbRaw_DbiVer PDBDbiStream::getDbiVersion() const {
- uint32_t Value = Header->VersionHeader;
- return static_cast<PdbRaw_DbiVer>(Value);
-}
-
-uint32_t PDBDbiStream::getAge() const { return Header->Age; }
-
-bool PDBDbiStream::isIncrementallyLinked() const {
- return (Header->Flags & FlagIncrementalMask) != 0;
-}
-
-bool PDBDbiStream::hasCTypes() const {
- return (Header->Flags & FlagHasCTypesMask) != 0;
-}
-
-bool PDBDbiStream::isStripped() const {
- return (Header->Flags & FlagStrippedMask) != 0;
-}
-
-uint16_t PDBDbiStream::getBuildMajorVersion() const {
- return (Header->BuildNumber & BuildMajorMask) >> BuildMajorShift;
-}
-
-uint16_t PDBDbiStream::getBuildMinorVersion() const {
- return (Header->BuildNumber & BuildMinorMask) >> BuildMinorShift;
-}
-
-uint32_t PDBDbiStream::getPdbDllVersion() const {
- return Header->PdbDllVersion;
-}
-
-uint32_t PDBDbiStream::getNumberOfSymbols() const { return Header->SymRecords; }
-
-PDB_Machine PDBDbiStream::getMachineType() const {
- uint16_t Machine = Header->MachineType;
- return static_cast<PDB_Machine>(Machine);
-}
-
-ArrayRef<ModuleInfoEx> PDBDbiStream::modules() const { return ModuleInfos; }
-
-std::error_code PDBDbiStream::initializeFileInfo() {
- struct FileInfoSubstreamHeader {
- ulittle16_t NumModules; // Total # of modules, should match number of
- // records in the ModuleInfo substream.
- ulittle16_t NumSourceFiles; // Total # of source files. This value is not
- // accurate because PDB actually supports more
- // than 64k source files, so we ignore it and
- // compute the value from other stream fields.
- };
-
- // The layout of the FileInfoSubstream is like this:
- // struct {
- // ulittle16_t NumModules;
- // ulittle16_t NumSourceFiles;
- // ulittle16_t ModIndices[NumModules];
- // ulittle16_t ModFileCounts[NumModules];
- // ulittle32_t FileNameOffsets[NumSourceFiles];
- // char Names[][NumSourceFiles];
- // };
- // with the caveat that `NumSourceFiles` cannot be trusted, so
- // it is computed by summing `ModFileCounts`.
- //
- const uint8_t *Buf = &FileInfoSubstream.data().front();
- auto FI = reinterpret_cast<const FileInfoSubstreamHeader *>(Buf);
- Buf += sizeof(FileInfoSubstreamHeader);
- // The number of modules in the stream should be the same as reported by
- // the FileInfoSubstreamHeader.
- if (FI->NumModules != ModuleInfos.size())
- return std::make_error_code(std::errc::illegal_byte_sequence);
-
- // First is an array of `NumModules` module indices. This is not used for the
- // same reason that `NumSourceFiles` is not used. It's an array of uint16's,
- // but it's possible there are more than 64k source files, which would imply
- // more than 64k modules (e.g. object files) as well. So we ignore this
- // field.
- llvm::ArrayRef<ulittle16_t> ModIndexArray(
- reinterpret_cast<const ulittle16_t *>(Buf), ModuleInfos.size());
-
- llvm::ArrayRef<ulittle16_t> ModFileCountArray(ModIndexArray.end(),
- ModuleInfos.size());
-
- // Compute the real number of source files.
- uint32_t NumSourceFiles = 0;
- for (auto Count : ModFileCountArray)
- NumSourceFiles += Count;
-
- // This is the array that in the reference implementation corresponds to
- // `ModInfo::FileLayout::FileNameOffs`, which is commented there as being a
- // pointer. Due to the mentioned problems of pointers causing difficulty
- // when reading from the file on 64-bit systems, we continue to ignore that
- // field in `ModInfo`, and instead build a vector of StringRefs and stores
- // them in `ModuleInfoEx`. The value written to and read from the file is
- // not used anyway, it is only there as a way to store the offsets for the
- // purposes of later accessing the names at runtime.
- llvm::ArrayRef<little32_t> FileNameOffsets(
- reinterpret_cast<const little32_t *>(ModFileCountArray.end()),
- NumSourceFiles);
-
- const char *Names = reinterpret_cast<const char *>(FileNameOffsets.end());
-
- // We go through each ModuleInfo, determine the number N of source files for
- // that module, and then get the next N offsets from the Offsets array, using
- // them to get the corresponding N names from the Names buffer and associating
- // each one with the corresponding module.
- uint32_t NextFileIndex = 0;
- for (size_t I = 0; I < ModuleInfos.size(); ++I) {
- uint32_t NumFiles = ModFileCountArray[I];
- ModuleInfos[I].SourceFiles.resize(NumFiles);
- for (size_t J = 0; J < NumFiles; ++J, ++NextFileIndex) {
- uint32_t FileIndex = FileNameOffsets[NextFileIndex];
- ModuleInfos[I].SourceFiles[J] = StringRef(Names + FileIndex);
- }
- }
-
- return std::error_code();
-}
Modified: llvm/trunk/lib/DebugInfo/PDB/Raw/PDBFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/PDBFile.cpp?rev=268072&r1=268071&r2=268072&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/PDBFile.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/PDBFile.cpp Fri Apr 29 12:28:47 2016
@@ -9,12 +9,13 @@
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
#include "llvm/ADT/ArrayRef.h"
-#include "llvm/DebugInfo/PDB/Raw/PDBDbiStream.h"
-#include "llvm/DebugInfo/PDB/Raw/PDBInfoStream.h"
+#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
+#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/MemoryBuffer.h"
using namespace llvm;
+using namespace llvm::pdb;
namespace {
static const char Magic[] = {'M', 'i', 'c', 'r', 'o', 's', 'o', 'f',
@@ -45,7 +46,7 @@ struct SuperBlock {
};
}
-struct llvm::PDBFileContext {
+struct llvm::pdb::PDBFileContext {
std::unique_ptr<MemoryBuffer> Buffer;
const SuperBlock *SB;
std::vector<uint32_t> StreamSizes;
@@ -244,18 +245,18 @@ llvm::ArrayRef<support::ulittle32_t> PDB
getNumDirectoryBlocks());
}
-PDBInfoStream &PDBFile::getPDBInfoStream() {
- if (!InfoStream) {
- InfoStream.reset(new PDBInfoStream(*this));
- InfoStream->reload();
+InfoStream &PDBFile::getPDBInfoStream() {
+ if (!Info) {
+ Info.reset(new InfoStream(*this));
+ Info->reload();
}
- return *InfoStream;
+ return *Info;
}
-PDBDbiStream &PDBFile::getPDBDbiStream() {
- if (!DbiStream) {
- DbiStream.reset(new PDBDbiStream(*this));
- DbiStream->reload();
+DbiStream &PDBFile::getPDBDbiStream() {
+ if (!Dbi) {
+ Dbi.reset(new DbiStream(*this));
+ Dbi->reload();
}
- return *DbiStream;
+ return *Dbi;
}
Removed: llvm/trunk/lib/DebugInfo/PDB/Raw/PDBInfoStream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/PDBInfoStream.cpp?rev=268071&view=auto
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/PDBInfoStream.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/PDBInfoStream.cpp (removed)
@@ -1,56 +0,0 @@
-//===- PDBInfoStream.cpp - PDB Info Stream (Stream 1) Access ----*- 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/Raw/PDBInfoStream.h"
-#include "llvm/ADT/BitVector.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/DebugInfo/PDB/Raw/StreamReader.h"
-
-using namespace llvm;
-
-PDBInfoStream::PDBInfoStream(PDBFile &File) : Pdb(File), Stream(1, File) {}
-
-std::error_code PDBInfoStream::reload() {
- StreamReader Reader(Stream);
-
- support::ulittle32_t Value;
-
- Reader.readObject(&Value);
- Version = Value;
- if (Version < PdbRaw_ImplVer::PdbImplVC70)
- return std::make_error_code(std::errc::not_supported);
-
- Reader.readObject(&Value);
- Signature = Value;
-
- Reader.readObject(&Value);
- Age = Value;
-
- Reader.readObject(&Guid);
- NamedStreams.load(Reader);
-
- return std::error_code();
-}
-
-uint32_t PDBInfoStream::getNamedStreamIndex(llvm::StringRef Name) const {
- uint32_t Result;
- if (!NamedStreams.tryGetValue(Name, Result))
- return 0;
- return Result;
-}
-
-PdbRaw_ImplVer PDBInfoStream::getVersion() const {
- return static_cast<PdbRaw_ImplVer>(Version);
-}
-
-uint32_t PDBInfoStream::getSignature() const { return Signature; }
-
-uint32_t PDBInfoStream::getAge() const { return Age; }
-
-PDB_UniqueId PDBInfoStream::getGuid() const { return Guid; }
Removed: llvm/trunk/lib/DebugInfo/PDB/Raw/PDBNameMap.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/PDBNameMap.cpp?rev=268071&view=auto
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/PDBNameMap.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/PDBNameMap.cpp (removed)
@@ -1,109 +0,0 @@
-//===- PDBNameMap.cpp - PDB Name Map ----------------------------*- 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/Raw/PDBNameMap.h"
-#include "llvm/ADT/BitVector.h"
-#include "llvm/DebugInfo/PDB/Raw/StreamReader.h"
-
-using namespace llvm;
-
-PDBNameMap::PDBNameMap() {}
-
-std::error_code PDBNameMap::load(StreamReader &Stream) {
-
- // This is some sort of weird string-set/hash table encoded in the stream.
- // It starts with the number of bytes in the table.
- uint32_t NumberOfBytes;
- Stream.readInteger(NumberOfBytes);
-
- // Following that field is the starting offset of strings in the name table.
- uint32_t StringsOffset = Stream.getOffset();
- Stream.setOffset(StringsOffset + NumberOfBytes);
-
- // This appears to be equivalent to the total number of strings *actually*
- // in the name table.
- uint32_t HashSize;
- Stream.readInteger(HashSize);
-
- // This appears to be an upper bound on the number of strings in the name
- // table.
- uint32_t MaxNumberOfStrings;
- Stream.readInteger(MaxNumberOfStrings);
-
- // This appears to be a hash table which uses bitfields to determine whether
- // or not a bucket is 'present'.
- uint32_t NumPresentWords;
- Stream.readInteger(NumPresentWords);
-
- // Store all the 'present' bits in a vector for later processing.
- SmallVector<uint32_t, 1> PresentWords;
- for (uint32_t I = 0; I != NumPresentWords; ++I) {
- uint32_t Word;
- Stream.readInteger(Word);
- PresentWords.push_back(Word);
- }
-
- // This appears to be a hash table which uses bitfields to determine whether
- // or not a bucket is 'deleted'.
- uint32_t NumDeletedWords;
- Stream.readInteger(NumDeletedWords);
-
- // Store all the 'deleted' bits in a vector for later processing.
- SmallVector<uint32_t, 1> DeletedWords;
- for (uint32_t I = 0; I != NumDeletedWords; ++I) {
- uint32_t Word;
- Stream.readInteger(Word);
- DeletedWords.push_back(Word);
- }
-
- BitVector Present(MaxNumberOfStrings, false);
- if (!PresentWords.empty())
- Present.setBitsInMask(PresentWords.data(), PresentWords.size());
- BitVector Deleted(MaxNumberOfStrings, false);
- if (!DeletedWords.empty())
- Deleted.setBitsInMask(DeletedWords.data(), DeletedWords.size());
-
- for (uint32_t I = 0; I < MaxNumberOfStrings; ++I) {
- if (!Present.test(I))
- continue;
-
- // For all present entries, dump out their mapping.
-
- // This appears to be an offset relative to the start of the strings.
- // It tells us where the null-terminated string begins.
- uint32_t NameOffset;
- Stream.readInteger(NameOffset);
-
- // This appears to be a stream number into the stream directory.
- uint32_t NameIndex;
- Stream.readInteger(NameIndex);
-
- // Compute the offset of the start of the string relative to the stream.
- uint32_t StringOffset = StringsOffset + NameOffset;
- uint32_t OldOffset = Stream.getOffset();
- // Pump out our c-string from the stream.
- std::string Str;
- Stream.setOffset(StringOffset);
- Stream.readZeroString(Str);
-
- Stream.setOffset(OldOffset);
- // Add this to a string-map from name to stream number.
- Mapping.insert({Str, NameIndex});
- }
-
- return std::error_code();
-}
-
-bool PDBNameMap::tryGetValue(StringRef Name, uint32_t &Value) const {
- auto Iter = Mapping.find(Name);
- if (Iter == Mapping.end())
- return false;
- Value = Iter->second;
- return true;
-}
Modified: llvm/trunk/lib/DebugInfo/PDB/Raw/RawSession.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/RawSession.cpp?rev=268072&r1=268071&r2=268072&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/RawSession.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/RawSession.cpp Fri Apr 29 12:28:47 2016
@@ -18,6 +18,7 @@
#include "llvm/Support/MemoryBuffer.h"
using namespace llvm;
+using namespace llvm::pdb;
RawSession::RawSession(std::unique_ptr<PDBFile> PdbFile)
: Pdb(std::move(PdbFile)) {}
Modified: llvm/trunk/lib/DebugInfo/PDB/Raw/StreamReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Raw/StreamReader.cpp?rev=268072&r1=268071&r2=268072&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Raw/StreamReader.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Raw/StreamReader.cpp Fri Apr 29 12:28:47 2016
@@ -10,6 +10,7 @@
#include "llvm/DebugInfo/PDB/Raw/StreamReader.h"
using namespace llvm;
+using namespace llvm::pdb;
StreamReader::StreamReader(const StreamInterface &S) : Stream(S), Offset(0) {}
Modified: llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp?rev=268072&r1=268071&r2=268072&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp (original)
+++ llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp Fri Apr 29 12:28:47 2016
@@ -35,11 +35,11 @@
#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
#include "llvm/DebugInfo/PDB/PDBSymbolThunk.h"
+#include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
+#include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
#include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
#include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
-#include "llvm/DebugInfo/PDB/Raw/PDBDbiStream.h"
#include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
-#include "llvm/DebugInfo/PDB/Raw/PDBInfoStream.h"
#include "llvm/DebugInfo/PDB/Raw/RawSession.h"
#include "llvm/DebugInfo/PDB/Raw/StreamReader.h"
#include "llvm/Support/CommandLine.h"
@@ -61,6 +61,7 @@
#endif
using namespace llvm;
+using namespace llvm::pdb;
namespace opts {
@@ -237,15 +238,15 @@ static void dumpStructure(RawSession &RS
}
}
- PDBInfoStream &InfoStream = File.getPDBInfoStream();
- outs() << "Version: " << InfoStream.getVersion() << '\n';
+ InfoStream &IS = File.getPDBInfoStream();
+ outs() << "Version: " << IS.getVersion() << '\n';
outs() << "Signature: ";
- outs().write_hex(InfoStream.getSignature()) << '\n';
- outs() << "Age: " << InfoStream.getAge() << '\n';
- outs() << "Guid: " << InfoStream.getGuid() << '\n';
+ outs().write_hex(IS.getSignature()) << '\n';
+ outs() << "Age: " << IS.getAge() << '\n';
+ outs() << "Guid: " << IS.getGuid() << '\n';
// Let's try to dump out the named stream "/names".
- uint32_t NameStreamIndex = InfoStream.getNamedStreamIndex("/names");
+ uint32_t NameStreamIndex = IS.getNamedStreamIndex("/names");
if (NameStreamIndex != 0) {
MappedBlockStream NameStream(NameStreamIndex, File);
StreamReader Reader(NameStream);
@@ -267,24 +268,23 @@ static void dumpStructure(RawSession &RS
reportError("", std::make_error_code(std::errc::not_supported));
}
- PDBDbiStream &DbiStream = File.getPDBDbiStream();
- outs() << "Dbi Version: " << DbiStream.getDbiVersion() << '\n';
- outs() << "Age: " << DbiStream.getAge() << '\n';
- outs() << "Incremental Linking: " << DbiStream.isIncrementallyLinked()
- << '\n';
- outs() << "Has CTypes: " << DbiStream.hasCTypes() << '\n';
- outs() << "Is Stripped: " << DbiStream.isStripped() << '\n';
- outs() << "Machine Type: " << DbiStream.getMachineType() << '\n';
- outs() << "Number of Symbols: " << DbiStream.getNumberOfSymbols() << '\n';
+ DbiStream &DS = File.getPDBDbiStream();
+ outs() << "Dbi Version: " << DS.getDbiVersion() << '\n';
+ outs() << "Age: " << DS.getAge() << '\n';
+ outs() << "Incremental Linking: " << DS.isIncrementallyLinked() << '\n';
+ outs() << "Has CTypes: " << DS.hasCTypes() << '\n';
+ outs() << "Is Stripped: " << DS.isStripped() << '\n';
+ outs() << "Machine Type: " << DS.getMachineType() << '\n';
+ outs() << "Number of Symbols: " << DS.getNumberOfSymbols() << '\n';
- uint16_t Major = DbiStream.getBuildMajorVersion();
- uint16_t Minor = DbiStream.getBuildMinorVersion();
+ uint16_t Major = DS.getBuildMajorVersion();
+ uint16_t Minor = DS.getBuildMinorVersion();
outs() << "Toolchain Version: " << Major << "." << Minor << '\n';
outs() << "mspdb" << Major << Minor << ".dll version: " << Major << "."
- << Minor << "." << DbiStream.getPdbDllVersion() << '\n';
+ << Minor << "." << DS.getPdbDllVersion() << '\n';
outs() << "Modules: \n";
- for (auto &Modi : DbiStream.modules()) {
+ for (auto &Modi : DS.modules()) {
outs() << Modi.Info.getModuleName() << '\n';
outs().indent(4) << "Debug Stream Index: "
<< Modi.Info.getModuleStreamIndex() << '\n';
More information about the llvm-commits
mailing list