diff options
author | David Blaikie <dblaikie@gmail.com> | 2016-04-05 20:16:38 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2016-04-05 20:16:38 +0000 |
commit | fe34a372e1ab527f3102ec0521005a35eecdd229 (patch) | |
tree | 3226e2601c1e86586b2f1a10bea9d73a6ac0ff8e /tools/llvm-dwp | |
parent | cb6a5650f379761e693c6d89f854c2110bdecf81 (diff) |
llvm-dwp: Handle dwo files produced by GCC
To start with, handle DW_FORM_string names. Follow up commit will handle
the interesting quirk with type units I was originally aiming for here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265452 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-dwp')
-rw-r--r-- | tools/llvm-dwp/llvm-dwp.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/llvm-dwp/llvm-dwp.cpp b/tools/llvm-dwp/llvm-dwp.cpp index 737e396ed74..f9dada2075b 100644 --- a/tools/llvm-dwp/llvm-dwp.cpp +++ b/tools/llvm-dwp/llvm-dwp.cpp @@ -126,8 +126,13 @@ struct CompileUnitIdentifiers { const char *DWOName = ""; }; -static const char *getIndexedString(uint32_t StrIndex, StringRef StrOffsets, +static const char *getIndexedString(uint32_t Form, DataExtractor InfoData, + uint32_t &InfoOffset, StringRef StrOffsets, StringRef Str) { + if (Form == dwarf::DW_FORM_string) + return InfoData.getCStr(&InfoOffset); + assert(Form == dwarf::DW_FORM_GNU_str_index); + auto StrIndex = InfoData.getULEB128(&InfoOffset); DataExtractor StrOffsetsData(StrOffsets, true, 0); uint32_t StrOffsetsOffset = 4 * StrIndex; uint32_t StrOffset = StrOffsetsData.getU32(&StrOffsetsOffset); @@ -163,12 +168,11 @@ static CompileUnitIdentifiers getCUIdentifiers(StringRef Abbrev, StringRef Info, (Name != 0 || Form != 0)) { switch (Name) { case dwarf::DW_AT_name: { - ID.Name = getIndexedString(InfoData.getULEB128(&Offset), StrOffsets, Str); + ID.Name = getIndexedString(Form, InfoData, Offset, StrOffsets, Str); break; } case dwarf::DW_AT_GNU_dwo_name: { - ID.DWOName = - getIndexedString(InfoData.getULEB128(&Offset), StrOffsets, Str); + ID.DWOName = getIndexedString(Form, InfoData, Offset, StrOffsets, Str); break; } case dwarf::DW_AT_GNU_dwo_id: |