[llvm] r265452 - llvm-dwp: Handle dwo files produced by GCC
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 5 13:16:39 PDT 2016
Author: dblaikie
Date: Tue Apr 5 15:16:38 2016
New Revision: 265452
URL: http://llvm.org/viewvc/llvm-project?rev=265452&view=rev
Log:
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.
Added:
llvm/trunk/test/tools/llvm-dwp/Inputs/gcc_type/
llvm/trunk/test/tools/llvm-dwp/Inputs/gcc_type/a.dwo
Modified:
llvm/trunk/tools/llvm-dwp/llvm-dwp.cpp
Added: llvm/trunk/test/tools/llvm-dwp/Inputs/gcc_type/a.dwo
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-dwp/Inputs/gcc_type/a.dwo?rev=265452&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/llvm-dwp/Inputs/gcc_type/a.dwo (added) and llvm/trunk/test/tools/llvm-dwp/Inputs/gcc_type/a.dwo Tue Apr 5 15:16:38 2016 differ
Modified: llvm/trunk/tools/llvm-dwp/llvm-dwp.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-dwp/llvm-dwp.cpp?rev=265452&r1=265451&r2=265452&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-dwp/llvm-dwp.cpp (original)
+++ llvm/trunk/tools/llvm-dwp/llvm-dwp.cpp Tue Apr 5 15:16:38 2016
@@ -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 getCUIdent
(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:
More information about the llvm-commits
mailing list