summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2017-01-09 20:04:55 +0000
committerChris Bieneman <beanz@apple.com>2017-01-09 20:04:55 +0000
commite62e684fdd21a755b202a1733454f4153ec0f463 (patch)
tree8d7c1e9733335d1a4a09a8245bf33cc825cfa49d /llvm/tools
parent0396f9918438aaef9902b6ec9812bfa0f3859eea (diff)
downloadbcm5719-llvm-e62e684fdd21a755b202a1733454f4153ec0f463.tar.gz
bcm5719-llvm-e62e684fdd21a755b202a1733454f4153ec0f463.zip
Revert "[ObjectYAML] Support for DWARF line tables"
This reverts commit r291470 due to failing bots: http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/47209/steps/test_llvm/logs/stdio llvm-svn: 291471
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/obj2yaml/dwarf2yaml.cpp128
-rw-r--r--llvm/tools/yaml2obj/yaml2dwarf.cpp95
-rw-r--r--llvm/tools/yaml2obj/yaml2macho.cpp2
-rw-r--r--llvm/tools/yaml2obj/yaml2obj.h1
4 files changed, 1 insertions, 225 deletions
diff --git a/llvm/tools/obj2yaml/dwarf2yaml.cpp b/llvm/tools/obj2yaml/dwarf2yaml.cpp
index cbf34ed5388..cf8b3e5b927 100644
--- a/llvm/tools/obj2yaml/dwarf2yaml.cpp
+++ b/llvm/tools/obj2yaml/dwarf2yaml.cpp
@@ -127,7 +127,7 @@ void dumpDebugInfo(DWARFContextInMemory &DCtx, DWARFYAML::Data &Y) {
NewValue.Value = 0xDEADBEEFDEADBEEF;
DWARFDie DIEWrapper(CU.get(), &DIE);
auto FormValue = DIEWrapper.getAttributeValue(AttrSpec.Attr);
- if (!FormValue)
+ if(!FormValue)
return;
auto Form = FormValue.getValue().getForm();
bool indirect = false;
@@ -211,137 +211,11 @@ void dumpDebugInfo(DWARFContextInMemory &DCtx, DWARFYAML::Data &Y) {
}
}
-bool dumpFileEntry(DataExtractor &Data, uint32_t &Offset,
- DWARFYAML::File &File) {
- File.Name = Data.getCStr(&Offset);
- if (File.Name.empty())
- return false;
- File.DirIdx = Data.getULEB128(&Offset);
- File.ModTime = Data.getULEB128(&Offset);
- File.Length = Data.getULEB128(&Offset);
- return true;
-}
-
-void dumpDebugLines(DWARFContextInMemory &DCtx, DWARFYAML::Data &Y) {
- for (const auto &CU : DCtx.compile_units()) {
- auto CUDIE = CU->getUnitDIE();
- if (!CUDIE)
- continue;
- if (auto StmtOffset =
- CUDIE.getAttributeValueAsSectionOffset(dwarf::DW_AT_stmt_list)) {
- DWARFYAML::LineTable DebugLines;
- DataExtractor LineData(DCtx.getLineSection().Data, DCtx.isLittleEndian(),
- CU->getAddressByteSize());
- uint32_t Offset = *StmtOffset;
- uint64_t SizeOfPrologueLength = 4;
- DebugLines.TotalLength = LineData.getU32(&Offset);
- uint64_t LineTableLength = DebugLines.TotalLength;
- if (DebugLines.TotalLength == UINT32_MAX) {
- DebugLines.TotalLength64 = LineData.getU64(&Offset);
- LineTableLength = DebugLines.TotalLength64;
- SizeOfPrologueLength = 8;
- }
- DebugLines.Version = LineData.getU16(&Offset);
- DebugLines.PrologueLength =
- LineData.getUnsigned(&Offset, SizeOfPrologueLength);
- const uint64_t EndPrologue = DebugLines.PrologueLength + Offset;
-
- DebugLines.MinInstLength = LineData.getU8(&Offset);
- if (DebugLines.Version >= 4)
- DebugLines.MaxOpsPerInst = LineData.getU8(&Offset);
- DebugLines.DefaultIsStmt = LineData.getU8(&Offset);
- DebugLines.LineBase = LineData.getU8(&Offset);
- DebugLines.LineRange = LineData.getU8(&Offset);
- DebugLines.OpcodeBase = LineData.getU8(&Offset);
-
- DebugLines.StandardOpcodeLengths.reserve(DebugLines.OpcodeBase - 1);
- for (uint8_t i = 1; i < DebugLines.OpcodeBase; ++i)
- DebugLines.StandardOpcodeLengths.push_back(LineData.getU8(&Offset));
-
- while (Offset < EndPrologue) {
- StringRef Dir = LineData.getCStr(&Offset);
- if (!Dir.empty())
- DebugLines.IncludeDirs.push_back(Dir);
- else
- break;
- }
-
- while (Offset < EndPrologue) {
- DWARFYAML::File TmpFile;
- if (dumpFileEntry(LineData, Offset, TmpFile))
- DebugLines.Files.push_back(TmpFile);
- else
- break;
- }
-
- const uint64_t LineEnd =
- LineTableLength + *StmtOffset + SizeOfPrologueLength;
- while (Offset < LineEnd) {
- DWARFYAML::LineTableOpcode NewOp;
- NewOp.Opcode = (dwarf::LineNumberOps)LineData.getU8(&Offset);
- if (NewOp.Opcode == 0) {
- auto StartExt = Offset;
- NewOp.ExtLen = LineData.getULEB128(&Offset);
- NewOp.SubOpcode =
- (dwarf::LineNumberExtendedOps)LineData.getU8(&Offset);
- switch (NewOp.SubOpcode) {
- case dwarf::DW_LNE_set_address:
- case dwarf::DW_LNE_set_discriminator:
- NewOp.Data = LineData.getAddress(&Offset);
- break;
- case dwarf::DW_LNE_define_file:
- dumpFileEntry(LineData, Offset, NewOp.FileEntry);
- break;
- case dwarf::DW_LNE_end_sequence:
- break;
- default:
- while (Offset < StartExt + NewOp.ExtLen)
- NewOp.UnknownOpcodeData.push_back(LineData.getU8(&Offset));
- }
- } else if (NewOp.Opcode < DebugLines.OpcodeBase) {
- switch (NewOp.Opcode) {
- case dwarf::DW_LNS_copy:
- case dwarf::DW_LNS_negate_stmt:
- case dwarf::DW_LNS_set_basic_block:
- case dwarf::DW_LNS_const_add_pc:
- case dwarf::DW_LNS_set_prologue_end:
- case dwarf::DW_LNS_set_epilogue_begin:
- break;
-
- case dwarf::DW_LNS_advance_pc:
- case dwarf::DW_LNS_set_file:
- case dwarf::DW_LNS_set_column:
- case dwarf::DW_LNS_set_isa:
- NewOp.Data = LineData.getULEB128(&Offset);
- break;
-
- case dwarf::DW_LNS_advance_line:
- NewOp.SData = LineData.getSLEB128(&Offset);
- break;
-
- case dwarf::DW_LNS_fixed_advance_pc:
- NewOp.Data = LineData.getU16(&Offset);
- break;
-
- default:
- for (uint8_t i = 0;
- i < DebugLines.StandardOpcodeLengths[NewOp.Opcode - 1]; ++i)
- NewOp.StandardOpcodeData.push_back(LineData.getULEB128(&Offset));
- }
- }
- DebugLines.Opcodes.push_back(NewOp);
- }
- Y.DebugLines.push_back(DebugLines);
- }
- }
-}
-
std::error_code dwarf2yaml(DWARFContextInMemory &DCtx, DWARFYAML::Data &Y) {
dumpDebugAbbrev(DCtx, Y);
dumpDebugStrings(DCtx, Y);
dumpDebugARanges(DCtx, Y);
dumpDebugPubSections(DCtx, Y);
dumpDebugInfo(DCtx, Y);
- dumpDebugLines(DCtx, Y);
return obj2yaml_error::success;
}
diff --git a/llvm/tools/yaml2obj/yaml2dwarf.cpp b/llvm/tools/yaml2obj/yaml2dwarf.cpp
index 3ceb7772b96..8ba1190c56a 100644
--- a/llvm/tools/yaml2obj/yaml2dwarf.cpp
+++ b/llvm/tools/yaml2obj/yaml2dwarf.cpp
@@ -233,98 +233,3 @@ void yaml2debug_info(raw_ostream &OS, const DWARFYAML::Data &DI) {
}
}
}
-
-void yaml2FileEntry(raw_ostream &OS, const DWARFYAML::File &File) {
- OS.write(File.Name.data(), File.Name.size());
- OS.write('\0');
- encodeULEB128(File.DirIdx, OS);
- encodeULEB128(File.ModTime, OS);
- encodeULEB128(File.Length, OS);
-}
-
-void yaml2debug_line(raw_ostream &OS, const DWARFYAML::Data &DI) {
- for (const auto LineTable : DI.DebugLines) {
- writeInteger((uint32_t)LineTable.TotalLength, OS, DI.IsLittleEndian);
- uint64_t SizeOfPrologueLength = 4;
- if (LineTable.TotalLength == UINT32_MAX) {
- writeInteger((uint64_t)LineTable.TotalLength64, OS, DI.IsLittleEndian);
- SizeOfPrologueLength = 8;
- }
- writeInteger((uint16_t)LineTable.Version, OS, DI.IsLittleEndian);
- writeVariableSizedInteger(LineTable.PrologueLength, SizeOfPrologueLength,
- OS, DI.IsLittleEndian);
- writeInteger((uint8_t)LineTable.MinInstLength, OS, DI.IsLittleEndian);
- if (LineTable.Version >= 4)
- writeInteger((uint8_t)LineTable.MaxOpsPerInst, OS, DI.IsLittleEndian);
- writeInteger((uint8_t)LineTable.DefaultIsStmt, OS, DI.IsLittleEndian);
- writeInteger((uint8_t)LineTable.LineBase, OS, DI.IsLittleEndian);
- writeInteger((uint8_t)LineTable.LineRange, OS, DI.IsLittleEndian);
- writeInteger((uint8_t)LineTable.OpcodeBase, OS, DI.IsLittleEndian);
-
- for (auto OpcodeLength : LineTable.StandardOpcodeLengths)
- writeInteger((uint8_t)OpcodeLength, OS, DI.IsLittleEndian);
-
- for (auto IncludeDir : LineTable.IncludeDirs) {
- OS.write(IncludeDir.data(), IncludeDir.size());
- OS.write('\0');
- }
- OS.write('\0');
-
- for (auto File : LineTable.Files)
- yaml2FileEntry(OS, File);
- OS.write('\0');
-
- for (auto Op : LineTable.Opcodes) {
- writeInteger((uint8_t)Op.Opcode, OS, DI.IsLittleEndian);
- if (Op.Opcode == 0) {
- encodeULEB128(Op.ExtLen, OS);
- writeInteger((uint8_t)Op.SubOpcode, OS, DI.IsLittleEndian);
- switch (Op.SubOpcode) {
- case dwarf::DW_LNE_set_address:
- case dwarf::DW_LNE_set_discriminator:
- writeVariableSizedInteger(Op.Data, DI.CompileUnits[0].AddrSize, OS,
- DI.IsLittleEndian);
- break;
- case dwarf::DW_LNE_define_file:
- yaml2FileEntry(OS, Op.FileEntry);
- break;
- case dwarf::DW_LNE_end_sequence:
- break;
- default:
- for (auto OpByte : Op.UnknownOpcodeData)
- writeInteger((uint8_t)OpByte, OS, DI.IsLittleEndian);
- }
- } else if (Op.Opcode < LineTable.OpcodeBase) {
- switch (Op.Opcode) {
- case dwarf::DW_LNS_copy:
- case dwarf::DW_LNS_negate_stmt:
- case dwarf::DW_LNS_set_basic_block:
- case dwarf::DW_LNS_const_add_pc:
- case dwarf::DW_LNS_set_prologue_end:
- case dwarf::DW_LNS_set_epilogue_begin:
- break;
-
- case dwarf::DW_LNS_advance_pc:
- case dwarf::DW_LNS_set_file:
- case dwarf::DW_LNS_set_column:
- case dwarf::DW_LNS_set_isa:
- encodeULEB128(Op.Data, OS);
- break;
-
- case dwarf::DW_LNS_advance_line:
- encodeSLEB128(Op.SData, OS);
- break;
-
- case dwarf::DW_LNS_fixed_advance_pc:
- writeInteger((uint16_t)Op.Data, OS, DI.IsLittleEndian);
- break;
-
- default:
- for (auto OpData : Op.StandardOpcodeData) {
- encodeULEB128(OpData, OS);
- }
- }
- }
- }
- }
-}
diff --git a/llvm/tools/yaml2obj/yaml2macho.cpp b/llvm/tools/yaml2obj/yaml2macho.cpp
index cbc4d7ff50d..a41ec55d73b 100644
--- a/llvm/tools/yaml2obj/yaml2macho.cpp
+++ b/llvm/tools/yaml2obj/yaml2macho.cpp
@@ -280,8 +280,6 @@ Error MachOWriter::writeSectionData(raw_ostream &OS) {
yaml2pubsection(OS, Obj.DWARF.PubTypes, Obj.IsLittleEndian);
} else if (0 == strncmp(&Sec.sectname[0], "__debug_info", 16)) {
yaml2debug_info(OS, Obj.DWARF);
- } else if (0 == strncmp(&Sec.sectname[0], "__debug_line", 16)) {
- yaml2debug_line(OS, Obj.DWARF);
}
} else {
// Fills section data with 0xDEADBEEF
diff --git a/llvm/tools/yaml2obj/yaml2obj.h b/llvm/tools/yaml2obj/yaml2obj.h
index 4a637366e1a..7cad4ca8675 100644
--- a/llvm/tools/yaml2obj/yaml2obj.h
+++ b/llvm/tools/yaml2obj/yaml2obj.h
@@ -46,6 +46,5 @@ void yaml2pubsection(llvm::raw_ostream &OS,
const llvm::DWARFYAML::PubSection &Sect,
bool IsLittleEndian);
void yaml2debug_info(llvm::raw_ostream &OS, const llvm::DWARFYAML::Data &DI);
-void yaml2debug_line(llvm::raw_ostream &OS, const llvm::DWARFYAML::Data &DI);
#endif
OpenPOWER on IntegriCloud