LIEF: Library to Instrument Executable Formats
Version 2.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
lief-install
x86_64
static
include
LIEF
PDB
PDB/Function.hpp
Go to the documentation of this file.
1
/* Copyright 2022 - 2026 R. Thomas
2
*
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at
6
*
7
* http://www.apache.org/licenses/LICENSE-2.0
8
*
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
* See the License for the specific language governing permissions and
13
* limitations under the License.
14
*/
15
#ifndef LIEF_PDB_FUNCTION_H
16
#define LIEF_PDB_FUNCTION_H
17
#include <string_view>
18
#include <memory>
19
#include <ostream>
20
#include <string>
21
22
#include "
LIEF/DebugDeclOpt.hpp
"
23
#include "
LIEF/compiler_attributes.hpp
"
24
#include "
LIEF/debug_loc.hpp
"
25
#include "
LIEF/iterators.hpp
"
26
#include "
LIEF/visibility.h
"
27
28
29
namespace
LIEF::pdb
{
30
31
namespace
details
{
32
class
Function;
33
class
FunctionIt;
34
}
35
36
class
LIEF_API
Function
{
37
public
:
38
class
Iterator
final
39
:
public
iterator_facade_base<Iterator, std::forward_iterator_tag, Function,
40
std::ptrdiff_t, const Function*,
41
const Function&> {
42
public
:
43
using
implementation
= details::FunctionIt;
44
using
iterator_facade_base::operator++;
45
46
LIEF_API
Iterator
();
47
48
LIEF_API
Iterator
(std::unique_ptr<details::FunctionIt> impl);
49
50
LIEF_API
Iterator
(
const
Iterator
&);
51
LIEF_API
Iterator
&
operator=
(
const
Iterator
&);
52
53
LIEF_API
Iterator
(
Iterator
&&) noexcept;
54
LIEF_API
Iterator
& operator=(
Iterator
&&) noexcept;
55
56
LIEF_API
~
Iterator
();
57
58
friend
LIEF_API
bool
operator==(const
Iterator
& LHS, const
Iterator
& RHS);
59
friend
bool
operator!=(const
Iterator
& LHS, const
Iterator
& RHS) {
60
return
!(LHS == RHS);
61
}
62
63
// NOLINTNEXTLINE(bugprone-derived-method-shadowing-base-method)
64
LIEF_API
Iterator
&
operator++
();
65
66
LIEF_API
const
Function
&
operator*
() const
LIEF_LIFETIMEBOUND
;
67
68
// NOLINTNEXTLINE(bugprone-derived-method-shadowing-base-method)
69
LIEF_API
const
Function
* operator->() const
LIEF_LIFETIMEBOUND
;
70
73
LIEF_API
std::unique_ptr<
Function
>
yield
();
74
75
private:
76
void
load() const;
77
78
std::unique_ptr<
details
::FunctionIt> impl_;
79
mutable std::unique_ptr<
Function
> cached_;
80
};
81
Function
(std::unique_ptr<
details
::
Function
> impl);
82
~
Function
();
83
85
std::string_view
name
() const
LIEF_LIFETIMEBOUND
;
86
88
uint32_t
RVA
() const;
89
91
uint32_t
code_size
() const;
92
94
std::
string
section_name
() const;
95
97
debug_location_t
debug_location
() const;
98
100
std::
string
to_decl
(const
DeclOpt
& opt =
DeclOpt
()) const;
101
102
std::
string
to_string
() const;
103
104
LIEF_API
friend std::ostream& operator<<(std::ostream& os, const
Function
& F) {
105
os << F.to_string();
106
return
os;
107
}
108
109
private
:
110
std::unique_ptr<details::Function> impl_;
111
};
112
113
}
114
115
#endif
DebugDeclOpt.hpp
LIEF::DeclOpt
Configuration options for generated code from debug info.
Definition
DebugDeclOpt.hpp:37
LIEF::pdb::Function::Iterator::Iterator
Iterator()
LIEF::pdb::Function::Iterator::Iterator
Iterator(Iterator &&) noexcept
LIEF::pdb::Function::Iterator::operator++
Iterator & operator++()
LIEF::pdb::Function::Iterator::yield
std::unique_ptr< Function > yield()
Transfer ownership of the function at the current position to the caller. Returns nullptr if the iter...
LIEF::pdb::Function::Iterator::implementation
details::FunctionIt implementation
Definition
PDB/Function.hpp:43
LIEF::pdb::Function::Iterator::Iterator
Iterator(const Iterator &)
LIEF::pdb::Function::Iterator::operator*
const Function & operator*() const
LIEF::pdb::Function::Iterator::operator=
Iterator & operator=(const Iterator &)
LIEF::pdb::Function::Iterator::Iterator
Iterator(std::unique_ptr< details::FunctionIt > impl)
LIEF::pdb::Function::section_name
std::string section_name() const
The name of the section in which this function is defined.
LIEF::pdb::Function::code_size
uint32_t code_size() const
The size of the function.
LIEF::pdb::Function::Function
Function(std::unique_ptr< details::Function > impl)
LIEF::pdb::Function::name
std::string_view name() const
The name of the function (this name is usually demangled).
LIEF::pdb::Function::debug_location
debug_location_t debug_location() const
Original source code location.
LIEF::pdb::Function::RVA
uint32_t RVA() const
The Relative Virtual Address of the function.
LIEF::pdb::Function::to_decl
std::string to_decl(const DeclOpt &opt=DeclOpt()) const
Generate a C/C++ definition for this function.
LIEF::pdb::Function::to_string
std::string to_string() const
compiler_attributes.hpp
LIEF_LIFETIMEBOUND
#define LIEF_LIFETIMEBOUND
Definition
compiler_attributes.hpp:72
debug_loc.hpp
iterators.hpp
LIEF::pdb::details
Definition
BuildMetadata.hpp:31
LIEF::pdb
Definition
BuildMetadata.hpp:29
LIEF::debug_location_t
This structure holds a debug location (source filename & line).
Definition
debug_loc.hpp:23
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:45
Generated by
1.19.0