LIEF: Library to Instrument Executable Formats
Version 0.17.4
Toggle main menu visibility
Loading...
Searching...
No Matches
install
linux
x86_64
sdk
static
include
LIEF
Abstract
Abstract/DebugInfo.hpp
Go to the documentation of this file.
1
/* Copyright 2022 - 2025 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_DEBUGINFO_H
16
#define LIEF_DEBUGINFO_H
17
#include <memory>
18
#include <cstdint>
19
#include <string>
20
21
#include "
LIEF/visibility.h
"
22
#include "
LIEF/optional.hpp
"
23
namespace
LIEF
{
24
25
class
Binary
;
26
27
namespace
details
{
28
class
DebugInfo
;
29
}
30
38
class
LIEF_API
DebugInfo
{
39
public
:
40
friend
class
Binary
;
41
enum class
FORMAT
{
42
UNKNOWN = 0,
43
DWARF, PDB,
44
};
45
DebugInfo
(std::unique_ptr<details::DebugInfo> impl);
46
47
virtual
~DebugInfo
();
48
49
virtual
FORMAT
format
()
const
{
50
return
FORMAT::UNKNOWN
;
51
}
52
61
template
<
class
T>
62
const
T*
as
()
const
{
63
static_assert
(std::is_base_of<DebugInfo, T>::value,
64
"Require Instruction inheritance"
);
65
if
(T::classof(
this
)) {
66
return
static_cast<
const
T*
>
(
this
);
67
}
68
return
nullptr
;
69
}
70
72
virtual
optional<uint64_t>
find_function_address
(
const
std::string& name)
const
= 0;
73
74
protected
:
75
std::unique_ptr<details::DebugInfo> impl_;
76
};
77
78
}
79
#endif
LIEF::Binary
Generic interface representing a binary executable.
Definition
Abstract/Binary.hpp:59
LIEF::DebugInfo
This class provides a generic interface for accessing debug information from different formats such a...
Definition
Abstract/DebugInfo.hpp:38
LIEF::DebugInfo::DebugInfo
DebugInfo(std::unique_ptr< details::DebugInfo > impl)
LIEF::DebugInfo::~DebugInfo
virtual ~DebugInfo()
LIEF::DebugInfo::find_function_address
virtual optional< uint64_t > find_function_address(const std::string &name) const =0
Attempt to resolve the address of the function specified by name.
LIEF::DebugInfo::FORMAT
FORMAT
Definition
Abstract/DebugInfo.hpp:41
LIEF::DebugInfo::FORMAT::UNKNOWN
@ UNKNOWN
Definition
Abstract/DebugInfo.hpp:42
LIEF::DebugInfo::Binary
friend class Binary
Definition
Abstract/DebugInfo.hpp:40
LIEF::DebugInfo::as
const T * as() const
This function can be used to down cast a DebugInfo instance:
Definition
Abstract/DebugInfo.hpp:62
LIEF::DebugInfo::format
virtual FORMAT format() const
Definition
Abstract/DebugInfo.hpp:49
LIEF::optional
Definition
optional.hpp:23
LIEF::details
Definition
Abstract/DebugInfo.hpp:27
LIEF
LIEF namespace.
Definition
Abstract/Binary.hpp:40
optional.hpp
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:41
Generated by
1.17.0