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
PublicSymbol.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_PUBLIC_SYMBOL_H
16
#define LIEF_PDB_PUBLIC_SYMBOL_H
17
#include <string_view>
18
#include <cstdint>
19
#include <memory>
20
#include <ostream>
21
#include <string>
22
23
#include "
LIEF/compiler_attributes.hpp
"
24
#include "
LIEF/iterators.hpp
"
25
#include "
LIEF/visibility.h
"
26
27
28
namespace
LIEF::pdb
{
29
30
namespace
details
{
31
class
PublicSymbol;
32
class
PublicSymbolIt;
33
}
34
37
class
LIEF_API
PublicSymbol
{
38
public
:
39
class
Iterator
final
40
:
public
iterator_facade_base<Iterator, std::forward_iterator_tag,
41
PublicSymbol, std::ptrdiff_t,
42
const PublicSymbol*, const PublicSymbol&> {
43
public
:
44
using
implementation
= details::PublicSymbolIt;
45
using
iterator_facade_base::operator++;
46
47
LIEF_API
Iterator
();
48
49
LIEF_API
Iterator
(std::unique_ptr<details::PublicSymbolIt> impl);
50
51
LIEF_API
Iterator
(
const
Iterator
&);
52
LIEF_API
Iterator
&
operator=
(
const
Iterator
&);
53
54
LIEF_API
Iterator
(
Iterator
&&) noexcept;
55
LIEF_API
Iterator
& operator=(
Iterator
&&) noexcept;
56
57
LIEF_API
~
Iterator
();
58
59
// NOLINTNEXTLINE(bugprone-derived-method-shadowing-base-method)
60
LIEF_API
Iterator
& operator++();
61
62
friend
LIEF_API
bool
operator==(const
Iterator
& LHS, const
Iterator
& RHS);
63
64
friend
bool
operator!=(const
Iterator
& LHS, const
Iterator
& RHS) {
65
return
!(LHS == RHS);
66
}
67
68
LIEF_API
const
PublicSymbol
&
operator*
() const
LIEF_LIFETIMEBOUND
;
69
70
// NOLINTNEXTLINE(bugprone-derived-method-shadowing-base-method)
71
LIEF_API
const
PublicSymbol
* operator->() const
LIEF_LIFETIMEBOUND
;
72
75
LIEF_API
std::unique_ptr<
PublicSymbol
>
yield
();
76
77
private:
78
void
load() const;
79
80
std::unique_ptr<
details
::PublicSymbolIt> impl_;
81
mutable std::unique_ptr<
PublicSymbol
> cached_;
82
};
83
PublicSymbol
(std::unique_ptr<
details
::
PublicSymbol
> impl);
84
~
PublicSymbol
();
85
86
enum class
FLAGS
: uint32_t {
87
NONE = 0,
88
CODE = 1 << 0,
89
FUNCTION = 1 << 1,
90
MANAGED = 1 << 2,
91
MSIL = 1 << 3,
92
};
93
95
std::string_view
name
() const
LIEF_LIFETIMEBOUND
;
96
98
std::
string
demangled_name
() const;
99
103
std::
string
section_name
() const;
104
108
uint32_t
RVA
() const;
109
110
std::
string
to_string
() const;
111
112
LIEF_API
friend std::ostream& operator<<(std::ostream& os,
113
const
PublicSymbol
& sym) {
114
os << sym.to_string();
115
return
os;
116
}
117
118
private
:
119
std::unique_ptr<details::PublicSymbol> impl_;
120
};
121
122
}
123
124
#endif
LIEF::pdb::PublicSymbol::Iterator::yield
std::unique_ptr< PublicSymbol > yield()
Transfer ownership of the public symbol at the current position to the caller. Returns nullptr if the...
LIEF::pdb::PublicSymbol::Iterator::Iterator
Iterator(std::unique_ptr< details::PublicSymbolIt > impl)
LIEF::pdb::PublicSymbol::Iterator::Iterator
Iterator(const Iterator &)
LIEF::pdb::PublicSymbol::Iterator::Iterator
Iterator()
LIEF::pdb::PublicSymbol::Iterator::operator*
const PublicSymbol & operator*() const
LIEF::pdb::PublicSymbol::Iterator::operator=
Iterator & operator=(const Iterator &)
LIEF::pdb::PublicSymbol::Iterator::Iterator
Iterator(Iterator &&) noexcept
LIEF::pdb::PublicSymbol::Iterator::implementation
details::PublicSymbolIt implementation
Definition
PublicSymbol.hpp:44
LIEF::pdb::PublicSymbol::PublicSymbol
PublicSymbol(std::unique_ptr< details::PublicSymbol > impl)
LIEF::pdb::PublicSymbol::demangled_name
std::string demangled_name() const
Demangled representation of the symbol.
LIEF::pdb::PublicSymbol::to_string
std::string to_string() const
LIEF::pdb::PublicSymbol::name
std::string_view name() const
Name of the symbol.
LIEF::pdb::PublicSymbol::section_name
std::string section_name() const
Name of the section in which this symbol is defined (e.g. .text).
LIEF::pdb::PublicSymbol::FLAGS
FLAGS
Definition
PublicSymbol.hpp:86
LIEF::pdb::PublicSymbol::RVA
uint32_t RVA() const
Relative Virtual Address of this symbol.
compiler_attributes.hpp
LIEF_LIFETIMEBOUND
#define LIEF_LIFETIMEBOUND
Definition
compiler_attributes.hpp:72
iterators.hpp
LIEF::pdb::details
Definition
BuildMetadata.hpp:31
LIEF::pdb
Definition
BuildMetadata.hpp:29
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:45
Generated by
1.19.0