summaryrefslogtreecommitdiffstats
path: root/llvm/tools/obj2yaml/dwarf2yaml.cpp
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2016-12-20 00:42:06 +0000
committerChris Bieneman <beanz@apple.com>2016-12-20 00:42:06 +0000
commit891cbcc093f112fb9f4ec839cd286364f4b0bcb0 (patch)
treeeec032705d2c271fe0d7abbc5e71f9b40a9303f8 /llvm/tools/obj2yaml/dwarf2yaml.cpp
parentb5b0b23a25bf0a1eb0fc5f5aef8e0afc9301cdd7 (diff)
downloadbcm5719-llvm-891cbcc093f112fb9f4ec839cd286364f4b0bcb0.tar.gz
bcm5719-llvm-891cbcc093f112fb9f4ec839cd286364f4b0bcb0.zip
Revert "[ObjectYAML] Support for DWARF debug_info section"
This reverts commit r290147. This commit is breaking a bot (http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/621). I don't have time to investigate at the moment, so I'll revert for now. llvm-svn: 290148
Diffstat (limited to 'llvm/tools/obj2yaml/dwarf2yaml.cpp')
-rw-r--r--llvm/tools/obj2yaml/dwarf2yaml.cpp117
1 files changed, 3 insertions, 114 deletions
diff --git a/llvm/tools/obj2yaml/dwarf2yaml.cpp b/llvm/tools/obj2yaml/dwarf2yaml.cpp
index cf8b3e5b927..0fd646e23b9 100644
--- a/llvm/tools/obj2yaml/dwarf2yaml.cpp
+++ b/llvm/tools/obj2yaml/dwarf2yaml.cpp
@@ -10,11 +10,8 @@
#include "Error.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h"
-#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
#include "llvm/ObjectYAML/DWARFYAML.h"
-#include <algorithm>
-
using namespace llvm;
void dumpDebugAbbrev(DWARFContextInMemory &DCtx, DWARFYAML::Data &Y) {
@@ -102,120 +99,12 @@ void dumpDebugPubSections(DWARFContextInMemory &DCtx, DWARFYAML::Data &Y) {
dumpPubSection(DCtx, Y.GNUPubTypes, DCtx.getGnuPubTypesSection());
}
-void dumpDebugInfo(DWARFContextInMemory &DCtx, DWARFYAML::Data &Y) {
- for (const auto &CU : DCtx.compile_units()) {
- DWARFYAML::Unit NewUnit;
- NewUnit.Length = CU->getLength();
- NewUnit.Version = CU->getVersion();
- NewUnit.AbbrOffset = CU->getAbbreviations()->getOffset();
- NewUnit.AddrSize = CU->getAddressByteSize();
- for (auto DIE : CU->dies()) {
- DWARFYAML::Entry NewEntry;
- DataExtractor EntryData = CU->getDebugInfoExtractor();
- uint32_t offset = DIE.getOffset();
-
- assert(EntryData.isValidOffset(offset) && "Invalid DIE Offset");
- if (!EntryData.isValidOffset(offset))
- continue;
-
- NewEntry.AbbrCode = EntryData.getULEB128(&offset);
-
- auto AbbrevDecl = DIE.getAbbreviationDeclarationPtr();
- if (AbbrevDecl) {
- for (const auto &AttrSpec : AbbrevDecl->attributes()) {
- DWARFYAML::FormValue NewValue;
- NewValue.Value = 0xDEADBEEFDEADBEEF;
- DWARFDie DIEWrapper(CU.get(), &DIE);
- auto FormValue = DIEWrapper.getAttributeValue(AttrSpec.Attr);
- if(!FormValue)
- return;
- auto Form = FormValue.getValue().getForm();
- bool indirect = false;
- do {
- indirect = false;
- switch (Form) {
- case dwarf::DW_FORM_addr:
- case dwarf::DW_FORM_GNU_addr_index:
- if (auto Val = FormValue.getValue().getAsAddress())
- NewValue.Value = Val.getValue();
- break;
- case dwarf::DW_FORM_ref_addr:
- case dwarf::DW_FORM_ref1:
- case dwarf::DW_FORM_ref2:
- case dwarf::DW_FORM_ref4:
- case dwarf::DW_FORM_ref8:
- case dwarf::DW_FORM_ref_udata:
- case dwarf::DW_FORM_ref_sig8:
- if (auto Val = FormValue.getValue().getAsReferenceUVal())
- NewValue.Value = Val.getValue();
- break;
- case dwarf::DW_FORM_exprloc:
- case dwarf::DW_FORM_block:
- case dwarf::DW_FORM_block1:
- case dwarf::DW_FORM_block2:
- case dwarf::DW_FORM_block4:
- if (auto Val = FormValue.getValue().getAsBlock()) {
- auto BlockData = Val.getValue();
- std::copy(BlockData.begin(), BlockData.end(),
- std::back_inserter(NewValue.BlockData));
- }
- NewValue.Value = NewValue.BlockData.size();
- break;
- case dwarf::DW_FORM_data1:
- case dwarf::DW_FORM_flag:
- case dwarf::DW_FORM_data2:
- case dwarf::DW_FORM_data4:
- case dwarf::DW_FORM_data8:
- case dwarf::DW_FORM_sdata:
- case dwarf::DW_FORM_udata:
- if (auto Val = FormValue.getValue().getAsUnsignedConstant())
- NewValue.Value = Val.getValue();
- break;
- case dwarf::DW_FORM_string:
- if (auto Val = FormValue.getValue().getAsCString())
- NewValue.CStr = Val.getValue();
- break;
- case dwarf::DW_FORM_indirect:
- indirect = true;
- if (auto Val = FormValue.getValue().getAsUnsignedConstant()) {
- NewValue.Value = Val.getValue();
- NewEntry.Values.push_back(NewValue);
- Form = static_cast<dwarf::Form>(Val.getValue());
- }
- break;
- case dwarf::DW_FORM_strp:
- case dwarf::DW_FORM_sec_offset:
- case dwarf::DW_FORM_GNU_ref_alt:
- case dwarf::DW_FORM_GNU_strp_alt:
- case dwarf::DW_FORM_line_strp:
- case dwarf::DW_FORM_strp_sup:
- case dwarf::DW_FORM_ref_sup:
- case dwarf::DW_FORM_GNU_str_index:
- if (auto Val = FormValue.getValue().getAsCStringOffset())
- NewValue.Value = Val.getValue();
- break;
- case dwarf::DW_FORM_flag_present:
- NewValue.Value = 1;
- break;
- default:
- break;
- }
- } while (indirect);
- NewEntry.Values.push_back(NewValue);
- }
- }
-
- NewUnit.Entries.push_back(NewEntry);
- }
- Y.CompileUnits.push_back(NewUnit);
- }
-}
-
-std::error_code dwarf2yaml(DWARFContextInMemory &DCtx, DWARFYAML::Data &Y) {
+std::error_code dwarf2yaml(DWARFContextInMemory &DCtx,
+ DWARFYAML::Data &Y) {
dumpDebugAbbrev(DCtx, Y);
dumpDebugStrings(DCtx, Y);
dumpDebugARanges(DCtx, Y);
dumpDebugPubSections(DCtx, Y);
- dumpDebugInfo(DCtx, Y);
+
return obj2yaml_error::success;
}
OpenPOWER on IntegriCloud