-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pdb] Parse and dump section map and section contribs
Differential Revision: http://reviews.llvm.org/D20876 Reviewed By: rnk, ruiu llvm-svn: 271488
- Loading branch information
Zachary Turner
committed
Jun 2, 2016
1 parent
7cf29e3
commit 93839cb
Showing
17 changed files
with
1,196 additions
and
322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
//===- EnumTables.h Enum to string conversion tables ------------*- 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_CODEVIEW_ENUMTABLES_H | ||
#define LLVM_DEBUGINFO_CODEVIEW_ENUMTABLES_H | ||
|
||
#include "llvm/ADT/ArrayRef.h" | ||
#include "llvm/DebugInfo/CodeView/CodeView.h" | ||
#include "llvm/Support/COFF.h" | ||
#include "llvm/Support/ScopedPrinter.h" | ||
|
||
#include <stdint.h> | ||
|
||
namespace llvm { | ||
namespace codeview { | ||
ArrayRef<EnumEntry<SymbolKind>> getSymbolTypeNames(); | ||
ArrayRef<EnumEntry<uint16_t>> getRegisterNames(); | ||
ArrayRef<EnumEntry<uint8_t>> getProcSymFlagNames(); | ||
ArrayRef<EnumEntry<uint16_t>> getLocalFlagNames(); | ||
ArrayRef<EnumEntry<uint32_t>> getFrameCookieKindNames(); | ||
ArrayRef<EnumEntry<SourceLanguage>> getSourceLanguageNames(); | ||
ArrayRef<EnumEntry<uint32_t>> getCompileSym2FlagNames(); | ||
ArrayRef<EnumEntry<uint32_t>> getCompileSym3FlagNames(); | ||
ArrayRef<EnumEntry<unsigned>> getCPUTypeNames(); | ||
ArrayRef<EnumEntry<uint32_t>> getFrameProcSymFlagNames(); | ||
ArrayRef<EnumEntry<uint16_t>> getExportSymFlagNames(); | ||
ArrayRef<EnumEntry<uint8_t>> getThunkOrdinalNames(); | ||
ArrayRef<EnumEntry<uint16_t>> getTrampolineNames(); | ||
ArrayRef<EnumEntry<COFF::SectionCharacteristics>> | ||
getImageSectionCharacteristicNames(); | ||
} // namespace codeview | ||
} // namespace llvm | ||
|
||
#endif // LLVM_DEBUGINFO_CODEVIEW_ENUMTABLES_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//===- EnumTables.h - Enum to string conversion tables ----------*- 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_ENUMTABLES_H | ||
#define LLVM_DEBUGINFO_PDB_RAW_ENUMTABLES_H | ||
|
||
#include "llvm/ADT/ArrayRef.h" | ||
#include "llvm/Support/ScopedPrinter.h" | ||
|
||
namespace llvm { | ||
namespace pdb { | ||
ArrayRef<EnumEntry<uint16_t>> getOMFSegMapDescFlagNames(); | ||
} | ||
} | ||
|
||
#endif // LLVM_DEBUGINFO_PDB_RAW_ENUMTABLES_H |
28 changes: 28 additions & 0 deletions
28
llvm/include/llvm/DebugInfo/PDB/Raw/ISectionContribVisitor.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//===- ISectionContribVisitor.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_ISECTIONCONTRIBVISITOR_H | ||
#define LLVM_DEBUGINFO_PDB_RAW_ISECTIONCONTRIBVISITOR_H | ||
|
||
namespace llvm { | ||
namespace pdb { | ||
struct SectionContrib; | ||
struct SectionContrib2; | ||
|
||
class ISectionContribVisitor { | ||
public: | ||
virtual ~ISectionContribVisitor() {} | ||
|
||
virtual void visit(const SectionContrib &C) = 0; | ||
virtual void visit(const SectionContrib2 &C) = 0; | ||
}; | ||
} // namespace pdb | ||
} // namespace llvm | ||
|
||
#endif // LLVM_DEBUGINFO_PDB_RAW_ISECTIONCONTRIBVISITOR_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
//===- RawTypes.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_RAWTYPES_H | ||
#define LLVM_DEBUGINFO_PDB_RAW_RAWTYPES_H | ||
|
||
#include "llvm/Support/Endian.h" | ||
|
||
namespace llvm { | ||
namespace pdb { | ||
// This struct is defined as "SO" in langapi/include/pdb.h. | ||
struct SectionOffset { | ||
support::ulittle32_t Off; | ||
support::ulittle16_t Isect; | ||
char Padding[2]; | ||
}; | ||
|
||
// This is HRFile. | ||
struct PSHashRecord { | ||
support::ulittle32_t Off; // Offset in the symbol record stream | ||
support::ulittle32_t CRef; | ||
}; | ||
|
||
// This struct is defined as `SC` in include/dbicommon.h | ||
struct SectionContrib { | ||
support::ulittle16_t ISect; | ||
char Padding[2]; | ||
support::little32_t Off; | ||
support::little32_t Size; | ||
support::ulittle32_t Characteristics; | ||
support::ulittle16_t Imod; | ||
char Padding2[2]; | ||
support::ulittle32_t DataCrc; | ||
support::ulittle32_t RelocCrc; | ||
}; | ||
|
||
// This struct is defined as `SC2` in include/dbicommon.h | ||
struct SectionContrib2 { | ||
// To guarantee SectionContrib2 is standard layout, we cannot use inheritance. | ||
SectionContrib Base; | ||
support::ulittle32_t ISectCoff; | ||
}; | ||
|
||
// This corresponds to the `OMFSegMap` structure. | ||
struct SecMapHeader { | ||
support::ulittle16_t SecCount; // Number of segment descriptors in table | ||
support::ulittle16_t SecCountLog; // Number of logical segment descriptors | ||
}; | ||
|
||
// This corresponds to the `OMFSegMapDesc` structure. The definition is not | ||
// present in the reference implementation, but the layout is derived from | ||
// code that accesses the fields. | ||
struct SecMapEntry { | ||
support::ulittle16_t Flags; // Descriptor flags. See OMFSegDescFlags | ||
support::ulittle16_t Ovl; // Logical overlay number. | ||
support::ulittle16_t Group; // Group index into descriptor array. | ||
support::ulittle16_t Frame; | ||
support::ulittle16_t SecName; // Byte index of the segment or group name | ||
// in the sstSegName table, or 0xFFFF. | ||
support::ulittle16_t ClassName; // Byte index of the class name in the | ||
// sstSegName table, or 0xFFFF. | ||
support::ulittle32_t Offset; // Byte offset of the logical segment | ||
// within the specified physical segment. | ||
// If group is set in flags, offset is the | ||
// offset of the group. | ||
support::ulittle32_t SecByteLength; // Byte count of the segment or group. | ||
}; | ||
|
||
} // namespace pdb | ||
} // namespace llvm | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.