diff options
| author | George Rimar <grimar@accesssoftek.com> | 2016-12-17 10:18:05 +0000 |
|---|---|---|
| committer | George Rimar <grimar@accesssoftek.com> | 2016-12-17 10:18:05 +0000 |
| commit | 607fa711b2c9023daea909b539322250a79dec8a (patch) | |
| tree | c9e5aabe499e7acbfbbcd2f69f0e51b30f3dfa00 | |
| parent | 83e0dbcaadab1cb9984c5fa15e26690444be57b5 (diff) | |
| download | bcm5719-llvm-607fa711b2c9023daea909b539322250a79dec8a.tar.gz bcm5719-llvm-607fa711b2c9023daea909b539322250a79dec8a.zip | |
[ELF] - Use DWARFDebugPubTable parser class intead of hand-written parsing.
DWARFDebugPubTable was introduced recently and allows us to get rid of
code duplication in LLD.
llvm-svn: 290042
| -rw-r--r-- | lld/ELF/GdbIndex.cpp | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/lld/ELF/GdbIndex.cpp b/lld/ELF/GdbIndex.cpp index d34c4b0d7ed..74ebcf92400 100644 --- a/lld/ELF/GdbIndex.cpp +++ b/lld/ELF/GdbIndex.cpp @@ -59,7 +59,7 @@ //===----------------------------------------------------------------------===// #include "GdbIndex.h" - +#include "llvm/DebugInfo/DWARF/DWARFDebugPubTable.h" #include "llvm/Object/ELFObjectFile.h" using namespace llvm; @@ -95,22 +95,11 @@ GdbIndexBuilder<ELFT>::readPubNamesAndTypes() { std::vector<std::pair<StringRef, uint8_t>> Ret; for (StringRef D : Data) { - DataExtractor PubNames(D, IsLE, 0); - uint32_t Offset = 0; - while (PubNames.isValidOffset(Offset)) { - // Skip length, version, unit offset and size. - Offset += 14; - while (Offset < D.size()) { - uint32_t DieRef = PubNames.getU32(&Offset); - if (DieRef == 0) - break; - uint8_t Flags = PubNames.getU8(&Offset); - const char *Name = PubNames.getCStr(&Offset); - Ret.push_back({Name, Flags}); - } - } + DWARFDebugPubTable PubTable(D, IsLE, true); + for (const DWARFDebugPubTable::Set &S : PubTable.getData()) + for (const DWARFDebugPubTable::Entry &E : S.Entries) + Ret.push_back({E.Name, E.Descriptor.toBits()}); } - return Ret; } |

