diff options
author | Aaron Smith <aaron.smith@microsoft.com> | 2017-11-16 14:33:09 +0000 |
---|---|---|
committer | Aaron Smith <aaron.smith@microsoft.com> | 2017-11-16 14:33:09 +0000 |
commit | 89bca9e56642a1631acfa7a874489a1a989927dc (patch) | |
tree | 5f320ecb28dc503746e9f113f52da06ecb5eca04 /llvm/lib/DebugInfo/PDB/DIA/DIAEnumTables.cpp | |
parent | e8e6acdac98cf0c1d7f15a7593590fb8dad64b1a (diff) | |
download | bcm5719-llvm-89bca9e56642a1631acfa7a874489a1a989927dc.tar.gz bcm5719-llvm-89bca9e56642a1631acfa7a874489a1a989927dc.zip |
[DebugInfo/PDB] Adding getUndecoratedNameEx and IPDB interfaces for IDiaEnumTables and IDiaTable.
Initial changes to support debugging PE/COFF files with LLDB on Windows through DIA SDK.
There is another set of changes required on the LLDB side before this does anything.
Differential Revision: https://reviews.llvm.org/D39517
llvm-svn: 318403
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/DIA/DIAEnumTables.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/DIA/DIAEnumTables.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/PDB/DIA/DIAEnumTables.cpp b/llvm/lib/DebugInfo/PDB/DIA/DIAEnumTables.cpp new file mode 100644 index 00000000000..511b55585eb --- /dev/null +++ b/llvm/lib/DebugInfo/PDB/DIA/DIAEnumTables.cpp @@ -0,0 +1,53 @@ +//===- DIAEnumTables.cpp - DIA Table Enumerator Impl ------------*- 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/DIAEnumTables.h" +#include "llvm/DebugInfo/PDB/DIA/DIATable.h" + +using namespace llvm; +using namespace llvm::pdb; + +DIAEnumTables::DIAEnumTables( + CComPtr<IDiaEnumTables> DiaEnumerator) + : Enumerator(DiaEnumerator) {} + +uint32_t DIAEnumTables::getChildCount() const { + LONG Count = 0; + return (S_OK == Enumerator->get_Count(&Count)) ? Count : 0; +} + +std::unique_ptr<IPDBTable> +DIAEnumTables::getChildAtIndex(uint32_t Index) const { + CComPtr<IDiaTable> Item; + VARIANT Var; + Var.vt = VT_UINT; + Var.uintVal = Index; + if (S_OK != Enumerator->Item(Var, &Item)) + return nullptr; + + return std::unique_ptr<IPDBTable>(new DIATable(Item)); +} + +std::unique_ptr<IPDBTable> DIAEnumTables::getNext() { + CComPtr<IDiaTable> Item; + ULONG CeltFetched = 0; + if (S_OK != Enumerator->Next(1, &Item, &CeltFetched)) + return nullptr; + + return std::unique_ptr<IPDBTable>(new DIATable(Item)); +} + +void DIAEnumTables::reset() { Enumerator->Reset(); } + +DIAEnumTables *DIAEnumTables::clone() const { + CComPtr<IDiaEnumTables> EnumeratorClone; + if (S_OK != Enumerator->Clone(&EnumeratorClone)) + return nullptr; + return new DIAEnumTables(EnumeratorClone); +} |