18 #include "llvm/DebugInfo/CodeView/CodeView.h"
19 #include "llvm/DebugInfo/PDB/IPDBSession.h"
20 #include "llvm/DebugInfo/PDB/PDBSymbolData.h"
31 static std::unique_ptr<IPDBFrameData>
34 auto enumFrameData = session.getFrameData();
38 std::unique_ptr<IPDBFrameData> found;
39 while (
auto fd = enumFrameData->getNext()) {
41 fd->getLengthBlock());
43 for (
size_t i = 0; i < ranges.
GetSize(); i++) {
48 if (!range->DoesIntersect(fdRange))
51 found = std::move(fd);
61 llvm::StringRef program, llvm::Triple::ArchType arch_type,
Stream &stream) {
68 ModuleSP module,
const PDBSymbolData &symbol,
75 const ArchSpec &architecture = module->GetArchitecture();
76 llvm::Triple::ArchType arch_type = architecture.
GetMachine();
85 switch (symbol.getLocationType()) {
86 case PDB_LocType::Static:
87 case PDB_LocType::TLS: {
90 SectionList *section_list = module->GetSectionList();
94 uint32_t section_id = symbol.getAddressSection();
100 uint32_t offset = symbol.getAddressOffset();
101 stream.
PutMaxHex64(section->GetFileAddress() + offset, address_size,
108 case PDB_LocType::RegRel: {
110 auto reg_id = symbol.getRegisterId();
111 if (reg_id == llvm::codeview::RegisterId::VFRAME) {
115 int32_t offset = symbol.getOffset();
140 stream.
PutHex8(DW_OP_breg0 + reg_num);
142 int32_t offset = symbol.getOffset();
149 case PDB_LocType::Enregistered: {
159 stream.
PutHex8(DW_OP_reg0 + reg_num);
165 case PDB_LocType::Constant: {
166 Variant value = symbol.getValue();
167 stream.
PutRawBytes(&value.Value,
sizeof(value.Value),
175 DataBufferSP buffer =
176 std::make_shared<DataBufferHeap>(stream.
GetData(), stream.
GetSize());
177 DataExtractor extractor(buffer, byte_order, address_size, byte_size);