From d4a82f6f742be375d608f0193565568ac93e98c6 Mon Sep 17 00:00:00 2001 From: Aleksandr Urakov Date: Mon, 22 Oct 2018 07:18:08 +0000 Subject: [PDB] Extend IPDBSession's interface to retrieve frame data Summary: This patch just extends the `IPDBSession` interface to allow retrieving of frame data through it, and adds an implementation over DIA. It is needed for an implementation (for now with DIA) of the conversion from FPO programs to DWARF expressions mentioned in D53086. Reviewers: zturner, asmith, rnk Reviewed By: asmith Subscribers: mgorny, aprantl, JDevlieghere, llvm-commits Differential Revision: https://reviews.llvm.org/D53324 llvm-svn: 344886 --- llvm/lib/DebugInfo/PDB/DIA/DIAFrameData.cpp | 54 +++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 llvm/lib/DebugInfo/PDB/DIA/DIAFrameData.cpp (limited to 'llvm/lib/DebugInfo/PDB/DIA/DIAFrameData.cpp') diff --git a/llvm/lib/DebugInfo/PDB/DIA/DIAFrameData.cpp b/llvm/lib/DebugInfo/PDB/DIA/DIAFrameData.cpp new file mode 100644 index 00000000000..b904a2ff60a --- /dev/null +++ b/llvm/lib/DebugInfo/PDB/DIA/DIAFrameData.cpp @@ -0,0 +1,54 @@ +//===- DIAFrameData.cpp - DIA impl. of IPDBFrameData -------------- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/DebugInfo/PDB/DIA/DIAFrameData.h" +#include "llvm/DebugInfo/PDB/DIA/DIASession.h" +#include "llvm/DebugInfo/PDB/DIA/DIAUtils.h" + +using namespace llvm::pdb; + +DIAFrameData::DIAFrameData(const DIASession &PDBSession, + CComPtr DiaFrameData) + : Session(PDBSession), FrameData(DiaFrameData) {} + +template +ArgType +PrivateGetDIAValue(IDiaFrameData *FrameData, + HRESULT (__stdcall IDiaFrameData::*Method)(ArgType *)) { + ArgType Value; + if (S_OK == (FrameData->*Method)(&Value)) + return static_cast(Value); + + return ArgType(); +} + +uint32_t DIAFrameData::getAddressOffset() const { + return PrivateGetDIAValue(FrameData, &IDiaFrameData::get_addressOffset); +} + +uint32_t DIAFrameData::getAddressSection() const { + return PrivateGetDIAValue(FrameData, &IDiaFrameData::get_addressSection); +} + +uint32_t DIAFrameData::getLengthBlock() const { + return PrivateGetDIAValue(FrameData, &IDiaFrameData::get_lengthBlock); +} + +std::string DIAFrameData::getProgram() const { + return invokeBstrMethod(*FrameData, &IDiaFrameData::get_program); +} + +uint32_t DIAFrameData::getRelativeVirtualAddress() const { + return PrivateGetDIAValue(FrameData, + &IDiaFrameData::get_relativeVirtualAddress); +} + +uint64_t DIAFrameData::getVirtualAddress() const { + return PrivateGetDIAValue(FrameData, &IDiaFrameData::get_virtualAddress); +} -- cgit v1.2.3