LLVM
4.0.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
llvm.src
lib
DebugInfo
DWARF
DWARFDebugInfoEntry.cpp
Go to the documentation of this file.
1
//===-- DWARFDebugInfoEntry.cpp -------------------------------------------===//
2
//
3
// The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
10
#include "
SyntaxHighlighting.h
"
11
#include "
llvm/DebugInfo/DWARF/DWARFCompileUnit.h
"
12
#include "
llvm/DebugInfo/DWARF/DWARFContext.h
"
13
#include "
llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
"
14
#include "
llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
"
15
#include "
llvm/DebugInfo/DWARF/DWARFFormValue.h
"
16
#include "llvm/Support/DataTypes.h"
17
#include "
llvm/Support/Debug.h
"
18
#include "
llvm/Support/Dwarf.h
"
19
#include "
llvm/Support/Format.h
"
20
#include "
llvm/Support/raw_ostream.h
"
21
using namespace
llvm;
22
using namespace
dwarf;
23
using namespace
syntax;
24
25
bool
DWARFDebugInfoEntry::extractFast
(
const
DWARFUnit
&U,
26
uint32_t
*OffsetPtr) {
27
DataExtractor
DebugInfoData = U.
getDebugInfoExtractor
();
28
const
uint32_t
UEndOffset = U.
getNextUnitOffset
();
29
return
extractFast(U, OffsetPtr, DebugInfoData, UEndOffset, 0);
30
}
31
bool
DWARFDebugInfoEntry::extractFast
(
const
DWARFUnit
&U,
uint32_t
*OffsetPtr,
32
const
DataExtractor
&DebugInfoData,
33
uint32_t
UEndOffset,
uint32_t
D
) {
34
Offset
= *OffsetPtr;
35
Depth
=
D
;
36
if
(
Offset
>= UEndOffset || !DebugInfoData.
isValidOffset
(
Offset
))
37
return
false
;
38
uint64_t AbbrCode = DebugInfoData.
getULEB128
(OffsetPtr);
39
if
(0 == AbbrCode) {
40
// NULL debug tag entry.
41
AbbrevDecl =
nullptr
;
42
return
true
;
43
}
44
AbbrevDecl = U.
getAbbreviations
()->
getAbbreviationDeclaration
(AbbrCode);
45
if
(
nullptr
== AbbrevDecl) {
46
// Restore the original offset.
47
*OffsetPtr =
Offset
;
48
return
false
;
49
}
50
// See if all attributes in this DIE have fixed byte sizes. If so, we can
51
// just add this size to the offset to skip to the next DIE.
52
if
(
Optional<size_t>
FixedSize = AbbrevDecl->getFixedAttributesByteSize(U)) {
53
*OffsetPtr += *FixedSize;
54
return
true
;
55
}
56
57
// Skip all data in the .debug_info for the attributes
58
for
(
const
auto
&AttrSpec : AbbrevDecl->attributes()) {
59
// Check if this attribute has a fixed byte size.
60
if
(
auto
FixedSize = AttrSpec.getByteSize(U)) {
61
// Attribute byte size if fixed, just add the size to the offset.
62
*OffsetPtr += *FixedSize;
63
}
else
if
(!
DWARFFormValue::skipValue
(AttrSpec.Form, DebugInfoData,
64
OffsetPtr, &U)) {
65
// We failed to skip this attribute's value, restore the original offset
66
// and return the failure status.
67
*OffsetPtr =
Offset
;
68
return
false
;
69
}
70
}
71
return
true
;
72
}
Debug.h
llvm::DWARFUnit::getNextUnitOffset
uint32_t getNextUnitOffset() const
Definition:
DWARFUnit.h:202
DWARFDebugInfoEntry.h
llvm::DataExtractor::isValidOffset
bool isValidOffset(uint32_t offset) const
Test the validity of offset.
Definition:
DataExtractor.h:340
llvm::Depth
Definition:
SIMachineScheduler.h:37
DWARFDebugAbbrev.h
llvm::DWARFUnit::getAbbreviations
const DWARFAbbreviationDeclarationSet * getAbbreviations() const
Definition:
DWARFUnit.h:208
llvm::Optional
Definition:
Optional.h:29
DWARFFormValue.h
llvm::DWARFUnit
Definition:
DWARFUnit.h:106
D
static GCRegistry::Add< StatepointGC > D("statepoint-example","an example strategy for statepoint")
SyntaxHighlighting.h
llvm::DWARFDebugInfoEntry::extractFast
bool extractFast(const DWARFUnit &U, uint32_t *OffsetPtr)
Extracts a debug info entry, which is a child of a given unit, starting at a given offset...
Definition:
DWARFDebugInfoEntry.cpp:25
Offset
uint32_t Offset
Definition:
SymbolizableObjectFile.cpp:77
llvm::DataExtractor::getULEB128
uint64_t getULEB128(uint32_t *offset_ptr) const
Extract a unsigned LEB128 value from *offset_ptr.
Definition:
DataExtractor.cpp:131
DWARFCompileUnit.h
llvm::DataExtractor
Definition:
DataExtractor.h:17
Format.h
uint32_t
Dwarf.h
llvm::DWARFUnit::getDebugInfoExtractor
DataExtractor getDebugInfoExtractor() const
Definition:
DWARFUnit.h:184
llvm::DWARFAbbreviationDeclarationSet::getAbbreviationDeclaration
const DWARFAbbreviationDeclaration * getAbbreviationDeclaration(uint32_t AbbrCode) const
Definition:
DWARFDebugAbbrev.cpp:53
raw_ostream.h
llvm::DWARFFormValue::skipValue
bool skipValue(DataExtractor debug_info_data, uint32_t *offset_ptr, const DWARFUnit *U) const
Skip a form in debug_info_data at offset specified by offset_ptr.
Definition:
DWARFFormValue.cpp:419
DWARFContext.h
Generated on Wed Mar 8 2017 17:08:14 for LLVM by
1.8.6