LLVM
22.0.0git
include
llvm
DebugInfo
GSYM
DwarfTransformer.h
Go to the documentation of this file.
1
//===- DwarfTransformer.h ---------------------------------------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#ifndef LLVM_DEBUGINFO_GSYM_DWARFTRANSFORMER_H
10
#define LLVM_DEBUGINFO_GSYM_DWARFTRANSFORMER_H
11
12
#include "
llvm/ADT/StringRef.h
"
13
#include "
llvm/DebugInfo/DWARF/DWARFContext.h
"
14
#include "
llvm/DebugInfo/GSYM/ExtractRanges.h
"
15
#include "
llvm/Support/Compiler.h
"
16
#include "
llvm/Support/Error.h
"
17
18
namespace
llvm
{
19
20
class
raw_ostream
;
21
22
namespace
gsym
{
23
24
struct
CUInfo
;
25
struct
FunctionInfo
;
26
class
GsymCreator
;
27
class
OutputAggregator
;
28
29
/// A class that transforms the DWARF in a DWARFContext into GSYM information
30
/// by populating the GsymCreator object that it is constructed with. This
31
/// class supports converting all DW_TAG_subprogram DIEs into
32
/// gsym::FunctionInfo objects that includes line table information and inline
33
/// function information. Creating a separate class to transform this data
34
/// allows this class to be unit tested.
35
class
DwarfTransformer
{
36
public
:
37
/// Create a DWARF transformer.
38
///
39
/// \param D The DWARF to use when converting to GSYM.
40
///
41
/// \param G The GSYM creator to populate with the function information
42
/// from the debug info.
43
///
44
/// \param LDCS Flag to indicate whether we should load the call site
45
/// information from DWARF `DW_TAG_call_site` entries
46
///
47
/// \param MachO Flag to indicate if the object file is mach-o (Apple's
48
/// executable format). Apple has some compile unit attributes that look like
49
/// split DWARF, but they aren't and they can cause warnins to be emitted
50
/// about missing DWO files.
51
DwarfTransformer
(
DWARFContext
&
D
,
GsymCreator
&
G
,
bool
LDCS =
false
,
52
bool
MachO
=
false
)
53
: DICtx(
D
), Gsym(
G
), LoadDwarfCallSites(LDCS), IsMachO(
MachO
) {}
54
55
/// Extract the DWARF from the supplied object file and convert it into the
56
/// Gsym format in the GsymCreator object that is passed in. Returns an
57
/// error if something fatal is encountered.
58
///
59
/// \param NumThreads The number of threads that the conversion process can
60
/// use.
61
///
62
/// \param OS The stream to log warnings and non fatal issues to. If NULL
63
/// then don't log.
64
///
65
/// \returns An error indicating any fatal issues that happen when parsing
66
/// the DWARF, or Error::success() if all goes well.
67
LLVM_ABI
llvm::Error
convert
(
uint32_t
NumThreads,
OutputAggregator
&OS);
68
69
LLVM_ABI
llvm::Error
verify
(
StringRef
GsymPath,
OutputAggregator
&OS);
70
71
private
:
72
73
/// Parse the DWARF in the object file and convert it into the GsymCreator.
74
Error
parse
();
75
76
/// Handle any DIE (debug info entry) from the DWARF.
77
///
78
/// This function will find all DW_TAG_subprogram DIEs that convert them into
79
/// GSYM FuntionInfo objects and add them to the GsymCreator supplied during
80
/// construction. The DIE and all its children will be recursively parsed
81
/// with calls to this function.
82
///
83
/// \param Strm The thread specific log stream for any non fatal errors and
84
/// warnings. Once a thread has finished parsing an entire compile unit, all
85
/// information in this temporary stream will be forwarded to the member
86
/// variable log. This keeps logging thread safe. If the value is NULL, then
87
/// don't log.
88
///
89
/// \param CUI The compile unit specific information that contains the DWARF
90
/// line table, cached file list, and other compile unit specific
91
/// information.
92
///
93
/// \param Die The DWARF debug info entry to parse.
94
void
handleDie(
OutputAggregator
&Strm,
CUInfo
&CUI,
DWARFDie
Die);
95
96
/// Parse call site information from DWARF
97
///
98
/// \param CUI The compile unit info for the current CU.
99
/// \param Die The DWARFDie for the function.
100
/// \param FI The FunctionInfo for the function being populated.
101
void
parseCallSiteInfoFromDwarf(
CUInfo
&CUI,
DWARFDie
Die,
FunctionInfo
&FI);
102
103
DWARFContext
&DICtx;
104
GsymCreator
&Gsym;
105
bool
LoadDwarfCallSites;
106
bool
IsMachO;
107
108
friend
class
DwarfTransformerTest
;
109
};
110
111
}
// namespace gsym
112
}
// namespace llvm
113
114
#endif
// LLVM_DEBUGINFO_GSYM_DWARFTRANSFORMER_H
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
Compiler.h
LLVM_ABI
#define LLVM_ABI
Definition
Compiler.h:213
DWARFContext.h
ExtractRanges.h
G
#define G(x, y, z)
Definition
MD5.cpp:56
verify
ppc ctr loops verify
Definition
PPCCTRLoopsVerify.cpp:71
StringRef.h
llvm::DWARFContext
DWARFContext This data structure is the top level entity that deals with dwarf debug information pars...
Definition
DWARFContext.h:49
llvm::DWARFDie
Utility class that carries the DWARF compile/type unit and the debug info entry in an object.
Definition
DWARFDie.h:43
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition
Error.h:159
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition
StringRef.h:55
llvm::gsym::DwarfTransformer::DwarfTransformerTest
friend class DwarfTransformerTest
Definition
DwarfTransformer.h:108
llvm::gsym::DwarfTransformer::convert
LLVM_ABI llvm::Error convert(uint32_t NumThreads, OutputAggregator &OS)
Extract the DWARF from the supplied object file and convert it into the Gsym format in the GsymCreato...
Definition
DwarfTransformer.cpp:636
llvm::gsym::DwarfTransformer::DwarfTransformer
DwarfTransformer(DWARFContext &D, GsymCreator &G, bool LDCS=false, bool MachO=false)
Create a DWARF transformer.
Definition
DwarfTransformer.h:51
llvm::gsym::GsymCreator
GsymCreator is used to emit GSYM data to a stand alone file or section within a file.
Definition
GsymCreator.h:135
llvm::gsym::OutputAggregator
Definition
OutputAggregator.h:24
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition
raw_ostream.h:53
uint32_t
Error.h
llvm::MachO
Definition
MachO.h:25
llvm::gsym
Definition
CallSiteInfo.h:27
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition
AddressRanges.h:18
llvm::gsym::CUInfo
Definition
DwarfTransformer.cpp:28
llvm::gsym::FunctionInfo
Function information in GSYM files encodes information for one contiguous address range.
Definition
FunctionInfo.h:93
parse
Definition
regcomp.c:186
Generated on
for LLVM by
1.14.0