LLVM  4.0.0
ModuleSubstream.h
Go to the documentation of this file.
1 //===- ModuleSubstream.h ----------------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_DEBUGINFO_CODEVIEW_MODULESUBSTREAM_H
11 #define LLVM_DEBUGINFO_CODEVIEW_MODULESUBSTREAM_H
12 
16 #include "llvm/Support/Endian.h"
17 #include "llvm/Support/Error.h"
18 
19 namespace llvm {
20 namespace codeview {
21 
22 // Corresponds to the `CV_DebugSSubsectionHeader_t` structure.
24  support::ulittle32_t Kind; // codeview::ModuleSubstreamKind enum
25  support::ulittle32_t Length; // number of bytes occupied by this record.
26 };
27 
28 // Corresponds to the `CV_DebugSLinesHeader_t` structure.
30  support::ulittle32_t RelocOffset; // Code offset of line contribution.
31  support::ulittle16_t RelocSegment; // Code segment of line contribution.
32  support::ulittle16_t Flags; // See LineFlags enumeration.
33  support::ulittle32_t CodeSize; // Code size of this line contribution.
34 };
35 
36 // Corresponds to the `CV_DebugSLinesFileBlockHeader_t` structure.
38  support::ulittle32_t NameIndex; // Index in DBI name buffer of filename.
39  support::ulittle32_t NumLines; // Number of lines
40  support::ulittle32_t BlockSize; // Code size of block, in bytes.
41  // The following two variable length arrays appear immediately after the
42  // header. The structure definitions follow.
43  // LineNumberEntry Lines[NumLines];
44  // ColumnNumberEntry Columns[NumLines];
45 };
46 
47 // Corresponds to `CV_Line_t` structure
49  support::ulittle32_t Offset; // Offset to start of code bytes for line number
50  support::ulittle32_t Flags; // Start:24, End:7, IsStatement:1
51 };
52 
53 // Corresponds to `CV_Column_t` structure
57 };
58 
60 public:
64  uint32_t getRecordLength() const;
67 
68 private:
71 };
72 
74 } // namespace codeview
75 
76 namespace msf {
77 template <> struct VarStreamArrayExtractor<codeview::ModuleSubstream> {
79  codeview::ModuleSubstream &Info) const {
80  if (auto EC = codeview::ModuleSubstream::initialize(Stream, Info))
81  return EC;
82  Length = Info.getRecordLength();
83  return Error::success();
84  }
85 };
86 } // namespace msf
87 } // namespace llvm
88 
89 #endif // LLVM_DEBUGINFO_CODEVIEW_MODULESUBSTREAM_H
ModuleSubstreamKind getSubstreamKind() const
static Error initialize(msf::ReadableStreamRef Stream, ModuleSubstream &Info)
static ErrorSuccess success()
Create a success value.
Error operator()(ReadableStreamRef Stream, uint32_t &Length, codeview::ModuleSubstream &Info) const
msf::VarStreamArray< ModuleSubstream > ModuleSubstreamArray
VarStreamArrayExtractor is intended to be specialized to provide customized extraction logic...
Definition: StreamArray.h:35
msf::ReadableStreamRef getRecordData() const
Lightweight error class with error context and mandatory checking.
support::ulittle16_t StartColumn