class CodeViewContext

Declaration

class CodeViewContext { /* full declaration omitted */ };

Description

Holds state from .cv_file and .cv_loc directives for later emission.

Declared at: llvm/include/llvm/MC/MCCodeView.h:144

Member Variables

private StringMap<unsigned int> StringTable
Map from string to string table offset.
private llvm::MCDataFragment* StrTabFragment = nullptr
The fragment that ultimately holds our strings.
private bool InsertedStrTabFragment = false
private SmallVector<llvm::CodeViewContext::FileInfo, 4> Files
Array storing added file information.
private std::map<unsigned int, std::pair<size_t, size_t>> MCCVLineStartStop
The offset of the first and last .cv_loc directive for a given function id.
private std::vector<MCCVLoc> MCCVLines
A collection of MCCVLoc for each section.
private std::vector<MCCVFunctionInfo> Functions
All known functions and inlined call sites, indexed by function id.
private bool ChecksumOffsetsAssigned = false
Indicate whether we have already laid out the checksum table addresses or not.

Method Overview

  • public CodeViewContext()
  • public bool addFile(llvm::MCStreamer & OS, unsigned int FileNumber, llvm::StringRef Filename, ArrayRef<uint8_t> ChecksumBytes, uint8_t ChecksumKind)
  • public void addLineEntry(const llvm::MCCVLoc & LineEntry)
  • public std::pair<StringRef, unsigned int> addToStringTable(llvm::StringRef S)
  • public llvm::MCFragment * emitDefRange(llvm::MCObjectStreamer & OS, ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges, llvm::StringRef FixedSizePortion)
  • public void emitFileChecksumOffset(llvm::MCObjectStreamer & OS, unsigned int FileNo)
  • public void emitFileChecksums(llvm::MCObjectStreamer & OS)
  • public void emitInlineLineTableForFunction(llvm::MCObjectStreamer & OS, unsigned int PrimaryFunctionId, unsigned int SourceFileId, unsigned int SourceLineNum, const llvm::MCSymbol * FnStartSym, const llvm::MCSymbol * FnEndSym)
  • public void emitLineTableForFunction(llvm::MCObjectStreamer & OS, unsigned int FuncId, const llvm::MCSymbol * FuncBegin, const llvm::MCSymbol * FuncEnd)
  • public void emitStringTable(llvm::MCObjectStreamer & OS)
  • public void encodeDefRange(llvm::MCAsmLayout & Layout, llvm::MCCVDefRangeFragment & F)
  • public void encodeInlineLineTable(llvm::MCAsmLayout & Layout, llvm::MCCVInlineLineTableFragment & F)
  • public llvm::MCCVFunctionInfo * getCVFunctionInfo(unsigned int FuncId)
  • public std::vector<MCCVLoc> getFunctionLineEntries(unsigned int FuncId)
  • public std::pair<size_t, size_t> getLineExtent(unsigned int FuncId)
  • public ArrayRef<llvm::MCCVLoc> getLinesForExtent(size_t L, size_t R)
  • private llvm::MCDataFragment * getStringTableFragment()
  • private unsigned int getStringTableOffset(llvm::StringRef S)
  • public bool isValidFileNumber(unsigned int FileNumber) const
  • public void recordCVLoc(llvm::MCContext & Ctx, const llvm::MCSymbol * Label, unsigned int FunctionId, unsigned int FileNo, unsigned int Line, unsigned int Column, bool PrologueEnd, bool IsStmt)
  • public bool recordFunctionId(unsigned int FuncId)
  • public bool recordInlinedCallSiteId(unsigned int FuncId, unsigned int IAFunc, unsigned int IAFile, unsigned int IALine, unsigned int IACol)
  • public ~CodeViewContext()

Methods

CodeViewContext()

Declared at: llvm/include/llvm/MC/MCCodeView.h:146

bool addFile(llvm::MCStreamer& OS,
             unsigned int FileNumber,
             llvm::StringRef Filename,
             ArrayRef<uint8_t> ChecksumBytes,
             uint8_t ChecksumKind)

Declared at: llvm/include/llvm/MC/MCCodeView.h:150

Parameters

llvm::MCStreamer& OS
unsigned int FileNumber
llvm::StringRef Filename
ArrayRef<uint8_t> ChecksumBytes
uint8_t ChecksumKind

void addLineEntry(const llvm::MCCVLoc& LineEntry)

Description

Add a line entry.

Declared at: llvm/include/llvm/MC/MCCodeView.h:177

Parameters

const llvm::MCCVLoc& LineEntry

std::pair<StringRef, unsigned int>
addToStringTable(llvm::StringRef S)

Description

Add something to the string table. Returns the final string as well as offset into the string table.

Declared at: llvm/include/llvm/MC/MCCodeView.h:219

Parameters

llvm::StringRef S

llvm::MCFragment* emitDefRange(
    llvm::MCObjectStreamer& OS,
    ArrayRef<std::pair<const MCSymbol*,
                       const MCSymbol*>> Ranges,
    llvm::StringRef FixedSizePortion)

Declared at: llvm/include/llvm/MC/MCCodeView.h:202

Parameters

llvm::MCObjectStreamer& OS
ArrayRef< std::pair<const MCSymbol*, const MCSymbol*>> Ranges
llvm::StringRef FixedSizePortion

void emitFileChecksumOffset(
    llvm::MCObjectStreamer& OS,
    unsigned int FileNo)

Description

Emits the offset into the checksum table of the given file number.

Declared at: llvm/include/llvm/MC/MCCodeView.h:215

Parameters

llvm::MCObjectStreamer& OS
unsigned int FileNo

void emitFileChecksums(llvm::MCObjectStreamer& OS)

Description

Emits the file checksum substream.

Declared at: llvm/include/llvm/MC/MCCodeView.h:212

Parameters

llvm::MCObjectStreamer& OS

void emitInlineLineTableForFunction(
    llvm::MCObjectStreamer& OS,
    unsigned int PrimaryFunctionId,
    unsigned int SourceFileId,
    unsigned int SourceLineNum,
    const llvm::MCSymbol* FnStartSym,
    const llvm::MCSymbol* FnEndSym)

Declared at: llvm/include/llvm/MC/MCCodeView.h:190

Parameters

llvm::MCObjectStreamer& OS
unsigned int PrimaryFunctionId
unsigned int SourceFileId
unsigned int SourceLineNum
const llvm::MCSymbol* FnStartSym
const llvm::MCSymbol* FnEndSym

void emitLineTableForFunction(
    llvm::MCObjectStreamer& OS,
    unsigned int FuncId,
    const llvm::MCSymbol* FuncBegin,
    const llvm::MCSymbol* FuncEnd)

Description

Emits a line table substream.

Declared at: llvm/include/llvm/MC/MCCodeView.h:186

Parameters

llvm::MCObjectStreamer& OS
unsigned int FuncId
const llvm::MCSymbol* FuncBegin
const llvm::MCSymbol* FuncEnd

void emitStringTable(llvm::MCObjectStreamer& OS)

Description

Emits the string table substream.

Declared at: llvm/include/llvm/MC/MCCodeView.h:209

Parameters

llvm::MCObjectStreamer& OS

void encodeDefRange(llvm::MCAsmLayout& Layout,
                    llvm::MCCVDefRangeFragment& F)

Declared at: llvm/include/llvm/MC/MCCodeView.h:206

Parameters

llvm::MCAsmLayout& Layout
llvm::MCCVDefRangeFragment& F

void encodeInlineLineTable(
    llvm::MCAsmLayout& Layout,
    llvm::MCCVInlineLineTableFragment& F)

Description

Encodes the binary annotations once we have a layout.

Declared at: llvm/include/llvm/MC/MCCodeView.h:198

Parameters

llvm::MCAsmLayout& Layout
llvm::MCCVInlineLineTableFragment& F

llvm::MCCVFunctionInfo* getCVFunctionInfo(
    unsigned int FuncId)

Description

Retreive the function info if this is a valid function id, or nullptr.

Declared at: llvm/include/llvm/MC/MCCodeView.h:166

Parameters

unsigned int FuncId

std::vector<MCCVLoc> getFunctionLineEntries(
    unsigned int FuncId)

Declared at: llvm/include/llvm/MC/MCCodeView.h:179

Parameters

unsigned int FuncId

std::pair<size_t, size_t> getLineExtent(
    unsigned int FuncId)

Declared at: llvm/include/llvm/MC/MCCodeView.h:181

Parameters

unsigned int FuncId

ArrayRef<llvm::MCCVLoc> getLinesForExtent(
    size_t L,
    size_t R)

Declared at: llvm/include/llvm/MC/MCCodeView.h:183

Parameters

size_t L
size_t R

llvm::MCDataFragment* getStringTableFragment()

Declared at: llvm/include/llvm/MC/MCCodeView.h:229

unsigned int getStringTableOffset(
    llvm::StringRef S)

Description

Get a string table offset.

Declared at: llvm/include/llvm/MC/MCCodeView.h:232

Parameters

llvm::StringRef S

bool isValidFileNumber(
    unsigned int FileNumber) const

Declared at: llvm/include/llvm/MC/MCCodeView.h:149

Parameters

unsigned int FileNumber

void recordCVLoc(llvm::MCContext& Ctx,
                 const llvm::MCSymbol* Label,
                 unsigned int FunctionId,
                 unsigned int FileNo,
                 unsigned int Line,
                 unsigned int Column,
                 bool PrologueEnd,
                 bool IsStmt)

Description

Saves the information from the currently parsed .cv_loc directive and sets CVLocSeen. When the next instruction is assembled an entry in the line number table with this information and the address of the instruction will be created.

Declared at: llvm/include/llvm/MC/MCCodeView.h:172

Parameters

llvm::MCContext& Ctx
const llvm::MCSymbol* Label
unsigned int FunctionId
unsigned int FileNo
unsigned int Line
unsigned int Column
bool PrologueEnd
bool IsStmt

bool recordFunctionId(unsigned int FuncId)

Description

Records the function id of a normal function. Returns false if the function id has already been used, and true otherwise.

Declared at: llvm/include/llvm/MC/MCCodeView.h:155

Parameters

unsigned int FuncId

bool recordInlinedCallSiteId(unsigned int FuncId,
                             unsigned int IAFunc,
                             unsigned int IAFile,
                             unsigned int IALine,
                             unsigned int IACol)

Description

Records the function id of an inlined call site. Records the "inlined at" location info of the call site, including what function or inlined call site it was inlined into. Returns false if the function id has already been used, and true otherwise.

Declared at: llvm/include/llvm/MC/MCCodeView.h:161

Parameters

unsigned int FuncId
unsigned int IAFunc
unsigned int IAFile
unsigned int IALine
unsigned int IACol

~CodeViewContext()

Declared at: llvm/include/llvm/MC/MCCodeView.h:147