18#include "llvm/DebugInfo/CodeView/CodeView.h"
19#include "llvm/DebugInfo/PDB/IPDBSession.h"
20#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
31static 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),
176 std::make_shared<DataBufferHeap>(stream.
GetData(), stream.
GetSize());
177 DataExtractor extractor(buffer, byte_order, address_size, byte_size);
static bool EmitVFrameEvaluationDWARFExpression(llvm::StringRef program, llvm::Triple::ArchType arch_type, Stream &stream)
DWARFExpression ConvertPDBLocationToDWARFExpression(ModuleSP module, const PDBSymbolData &symbol, const Variable::RangeList &ranges, bool &is_constant)
static std::unique_ptr< IPDBFrameData > GetCorrespondingFrameData(const IPDBSession &session, const Variable::RangeList &ranges)
An architecture specification class.
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
uint32_t GetDataByteSize() const
Architecture data byte width accessor.
lldb::ByteOrder GetByteOrder() const
Returns the byte order for the architecture specification.
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
"lldb/Expression/DWARFExpression.h" Encapsulates a DWARF location expression and interprets it.
void SetRegisterKind(lldb::RegisterKind reg_kind)
Set the call-frame-info style register kind.
const Entry * GetEntryAtIndex(size_t i) const
lldb::SectionSP FindSectionByID(lldb::user_id_t sect_id) const
const char * GetData() const
A stream class that can stream formatted output to a file.
@ eBinary
Get and put data as binary instead of as the default string mode.
size_t size_t PutHex8(uint8_t uvalue)
Append an uint8_t value in the hexadecimal format to the stream.
size_t PutULEB128(uint64_t uval)
Output a ULEB128 number to the stream.
size_t PutSLEB128(int64_t uval)
Output a SLEB128 number to the stream.
size_t PutRawBytes(const void *s, size_t src_len, lldb::ByteOrder src_byte_order=lldb::eByteOrderInvalid, lldb::ByteOrder dst_byte_order=lldb::eByteOrderInvalid)
size_t PutMaxHex64(uint64_t uvalue, size_t byte_size, lldb::ByteOrder byte_order=lldb::eByteOrderInvalid)
#define LLDB_INVALID_REGNUM
#define LLDB_REGNUM_GENERIC_FP
lldb::ByteOrder InlHostByteOrder()
bool TranslateFPOProgramToDWARFExpression(llvm::StringRef program, llvm::StringRef register_name, llvm::Triple::ArchType arch_type, lldb_private::Stream &stream)
uint32_t GetLLDBRegisterNumber(llvm::Triple::ArchType arch_type, llvm::codeview::RegisterId register_id)
A class that represents a running process on the host machine.
ByteOrder
Byte ordering definitions.
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
std::shared_ptr< lldb_private::Module > ModuleSP
RegisterKind
Register numbering types.
@ eRegisterKindGeneric
insn ptr reg, stack ptr reg, etc not specific to any particular target
@ eRegisterKindLLDB
lldb's internal register numbers
@ eRegisterKindDWARF
the register numbers seen DWARF