LLVM
20.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/Error.h
"
16
17
namespace
llvm
{
18
19
class
raw_ostream;
20
21
namespace
gsym {
22
23
struct
CUInfo;
24
struct
FunctionInfo;
25
class
GsymCreator;
26
class
OutputAggregator;
27
28
/// A class that transforms the DWARF in a DWARFContext into GSYM information
29
/// by populating the GsymCreator object that it is constructed with. This
30
/// class supports converting all DW_TAG_subprogram DIEs into
31
/// gsym::FunctionInfo objects that includes line table information and inline
32
/// function information. Creating a separate class to transform this data
33
/// allows this class to be unit tested.
34
class
DwarfTransformer
{
35
public
:
36
/// Create a DWARF transformer.
37
///
38
/// \param D The DWARF to use when converting to GSYM.
39
///
40
/// \param G The GSYM creator to populate with the function information
41
/// from the debug info.
42
///
43
/// \param LDCS Flag to indicate whether we should load the call site
44
/// information from DWARF `DW_TAG_call_site` entries
45
DwarfTransformer
(
DWARFContext
&
D
,
GsymCreator
&
G
,
bool
LDCS =
false
)
46
: DICtx(
D
), Gsym(
G
), LoadDwarfCallSites(LDCS) {}
47
48
/// Extract the DWARF from the supplied object file and convert it into the
49
/// Gsym format in the GsymCreator object that is passed in. Returns an
50
/// error if something fatal is encountered.
51
///
52
/// \param NumThreads The number of threads that the conversion process can
53
/// use.
54
///
55
/// \param OS The stream to log warnings and non fatal issues to. If NULL
56
/// then don't log.
57
///
58
/// \returns An error indicating any fatal issues that happen when parsing
59
/// the DWARF, or Error::success() if all goes well.
60
llvm::Error
convert
(
uint32_t
NumThreads,
OutputAggregator
&
OS
);
61
62
llvm::Error
verify
(
StringRef
GsymPath,
OutputAggregator
&
OS
);
63
64
private
:
65
66
/// Parse the DWARF in the object file and convert it into the GsymCreator.
67
Error
parse
();
68
69
/// Handle any DIE (debug info entry) from the DWARF.
70
///
71
/// This function will find all DW_TAG_subprogram DIEs that convert them into
72
/// GSYM FuntionInfo objects and add them to the GsymCreator supplied during
73
/// construction. The DIE and all its children will be recursively parsed
74
/// with calls to this function.
75
///
76
/// \param Strm The thread specific log stream for any non fatal errors and
77
/// warnings. Once a thread has finished parsing an entire compile unit, all
78
/// information in this temporary stream will be forwarded to the member
79
/// variable log. This keeps logging thread safe. If the value is NULL, then
80
/// don't log.
81
///
82
/// \param CUI The compile unit specific information that contains the DWARF
83
/// line table, cached file list, and other compile unit specific
84
/// information.
85
///
86
/// \param Die The DWARF debug info entry to parse.
87
void
handleDie(
OutputAggregator
&Strm,
CUInfo
&CUI,
DWARFDie
Die);
88
89
/// Parse call site information from DWARF
90
///
91
/// \param CUI The compile unit info for the current CU.
92
/// \param Die The DWARFDie for the function.
93
/// \param FI The FunctionInfo for the function being populated.
94
void
parseCallSiteInfoFromDwarf(
CUInfo
&CUI,
DWARFDie
Die,
FunctionInfo
&FI);
95
96
DWARFContext
&DICtx;
97
GsymCreator
&Gsym;
98
bool
LoadDwarfCallSites;
99
100
friend
class
DwarfTransformerTest
;
101
};
102
103
}
// namespace gsym
104
}
// namespace llvm
105
106
#endif
// LLVM_DEBUGINFO_GSYM_DWARFTRANSFORMER_H
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
DWARFContext.h
convert
expand large fp convert
Definition:
ExpandLargeFpConvert.cpp:702
ExtractRanges.h
G
#define G(x, y, z)
Definition:
MD5.cpp:56
verify
ppc ctr loops verify
Definition:
PPCCTRLoopsVerify.cpp:72
OS
raw_pwrite_stream & OS
Definition:
SampleProfWriter.cpp:51
StringRef.h
llvm::DWARFContext
DWARFContext This data structure is the top level entity that deals with dwarf debug information pars...
Definition:
DWARFContext.h:48
llvm::DWARFDie
Utility class that carries the DWARF compile/type unit and the debug info entry in an object.
Definition:
DWARFDie.h:42
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition:
Error.h:160
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition:
StringRef.h:51
llvm::gsym::DwarfTransformer
A class that transforms the DWARF in a DWARFContext into GSYM information by populating the GsymCreat...
Definition:
DwarfTransformer.h:34
llvm::gsym::DwarfTransformer::DwarfTransformerTest
friend class DwarfTransformerTest
Definition:
DwarfTransformer.h:100
llvm::gsym::DwarfTransformer::DwarfTransformer
DwarfTransformer(DWARFContext &D, GsymCreator &G, bool LDCS=false)
Create a DWARF transformer.
Definition:
DwarfTransformer.h:45
llvm::gsym::GsymCreator
GsymCreator is used to emit GSYM data to a stand alone file or section within a file.
Definition:
GsymCreator.h:134
llvm::gsym::OutputAggregator
Definition:
OutputAggregator.h:24
uint32_t
Error.h
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:92
parse
Definition:
regcomp.c:192
Generated on Sat Dec 21 2024 20:51:11 for LLVM by
1.9.6