LIEF: Library to Instrument Executable Formats Version 0.16.0
Loading...
Searching...
No Matches
debug/Debug.hpp
Go to the documentation of this file.
1
2/* Copyright 2017 - 2024 R. Thomas
3 * Copyright 2017 - 2024 Quarkslab
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17#ifndef LIEF_PE_DEBUG_H
18#define LIEF_PE_DEBUG_H
19#include <cstdint>
20#include <ostream>
21#include <memory>
22
23#include "LIEF/Object.hpp"
24#include "LIEF/visibility.h"
25
26namespace LIEF {
27namespace PE {
28class Parser;
29class Builder;
30
31namespace details {
32struct pe_debug;
33}
34class LIEF_API Debug : public Object {
39 friend class Parser;
40 friend class Builder;
41
42 public: enum class TYPES {
45 UNKNOWN = 0,
46 COFF = 1,
47 CODEVIEW = 2,
48 FPO = 3,
49 MISC = 4,
50 EXCEPTION = 5,
51 FIXUP = 6,
52 OMAP_TO_SRC = 7,
53 OMAP_FROM_SRC = 8,
54 BORLAND = 9,
55 RESERVED10 = 10,
56 CLSID = 11,
57 VC_FEATURE = 12,
58 POGO = 13,
59 ILTCG = 14,
60 MPX = 15,
61 REPRO = 16,
62 EX_DLLCHARACTERISTICS = 20,
63 };
64 Debug() = default;
65 Debug(TYPES type) {
66 type_ = type;
67 }
68
69 Debug(const details::pe_debug& debug_s);
70 Debug(const Debug& other) = default;
71 Debug& operator=(const Debug& other) = default;
72
73 ~Debug() override = default;
74
75 virtual std::unique_ptr<Debug> clone() const {
76 return std::unique_ptr<Debug>(new Debug(*this));
77 }
78 uint32_t characteristics() const {
81 return characteristics_;
82 }
83 uint32_t timestamp() const {
86 return timestamp_;
87 }
88 uint16_t major_version() const {
91 return major_version_;
92 }
93 uint16_t minor_version() const {
96 return minor_version_;
97 }
98 TYPES type() const {
101 return type_;
102 }
103 uint32_t sizeof_data() const {
106 return sizeof_data_;
107 }
108 uint32_t addressof_rawdata() const {
111 return addressof_rawdata_;
112 }
113 uint32_t pointerto_rawdata() const {
116 return pointerto_rawdata_;
117 }
118
119 void characteristics(uint32_t characteristics) {
120 characteristics_ = characteristics;
121 }
122
123 void timestamp(uint32_t timestamp) {
124 timestamp_ = timestamp;
125 }
126
127 void major_version(uint16_t major_version) {
128 major_version_ = major_version;
129 }
130
131 void minor_version(uint16_t minor_version) {
132 minor_version_ = minor_version;
133 }
134
135 void sizeof_data(uint32_t sizeof_data) {
136 sizeof_data_ = sizeof_data;
137 }
138
139 void addressof_rawdata(uint32_t addressof_rawdata) {
140 addressof_rawdata_ = addressof_rawdata;
141 }
142
143 void pointerto_rawdata(uint32_t pointerto_rawdata) {
144 pointerto_rawdata_ = pointerto_rawdata;
145 }
146
147 void accept(Visitor& visitor) const override;
148
149 LIEF_API friend std::ostream& operator<<(std::ostream& os, const Debug& entry);
150
151 protected:
152 TYPES type_ = TYPES::UNKNOWN;
153 uint32_t characteristics_ = 0;
154 uint32_t timestamp_ = 0;
155 uint16_t major_version_ = 0;
156 uint16_t minor_version_ = 0;
157 uint32_t sizeof_data_ = 0;
158 uint32_t addressof_rawdata_ = 0;
159 uint32_t pointerto_rawdata_ = 0;
160};
161
162LIEF_API const char* to_string(Debug::TYPES e);
163
164}
165}
166#endif
Object.hpp
LIEF::PE::Builder
Class that is used to rebuild a raw PE binary from a PE::Binary object.
Definition PE/Builder.hpp:45
LIEF::PE::Debug
This class represents a generic entry in the debug data directory. For known types,...
Definition debug/Debug.hpp:38
LIEF::PE::Debug::characteristics
void characteristics(uint32_t characteristics)
Definition debug/Debug.hpp:119
LIEF::PE::Debug::accept
void accept(Visitor &visitor) const override
LIEF::PE::Debug::Debug
Debug(const details::pe_debug &debug_s)
LIEF::PE::Debug::addressof_rawdata
uint32_t addressof_rawdata() const
Address of the debug data relative to the image base.
Definition debug/Debug.hpp:110
LIEF::PE::Debug::pointerto_rawdata
void pointerto_rawdata(uint32_t pointerto_rawdata)
Definition debug/Debug.hpp:143
LIEF::PE::Debug::sizeof_data
uint32_t sizeof_data() const
Size of the debug data.
Definition debug/Debug.hpp:105
LIEF::PE::Debug::major_version
uint16_t major_version() const
The major version number of the debug data format.
Definition debug/Debug.hpp:90
LIEF::PE::Debug::addressof_rawdata
void addressof_rawdata(uint32_t addressof_rawdata)
Definition debug/Debug.hpp:139
LIEF::PE::Debug::minor_version
uint16_t minor_version() const
The minor version number of the debug data format.
Definition debug/Debug.hpp:95
LIEF::PE::Debug::characteristics
uint32_t characteristics() const
Reserved should be 0.
Definition debug/Debug.hpp:80
LIEF::PE::Debug::major_version
void major_version(uint16_t major_version)
Definition debug/Debug.hpp:127
LIEF::PE::Debug::operator<<
friend std::ostream & operator<<(std::ostream &os, const Debug &entry)
LIEF::PE::Debug::clone
virtual std::unique_ptr< Debug > clone() const
Definition debug/Debug.hpp:75
LIEF::PE::Debug::sizeof_data
void sizeof_data(uint32_t sizeof_data)
Definition debug/Debug.hpp:135
LIEF::PE::Debug::Debug
Debug()=default
LIEF::PE::Debug::pointerto_rawdata
uint32_t pointerto_rawdata() const
File offset of the debug data.
Definition debug/Debug.hpp:115
LIEF::PE::Debug::Debug
Debug(const Debug &other)=default
LIEF::PE::Debug::timestamp
uint32_t timestamp() const
The time and date when the debug data was created.
Definition debug/Debug.hpp:85
LIEF::PE::Debug::~Debug
~Debug() override=default
LIEF::PE::Debug::minor_version
void minor_version(uint16_t minor_version)
Definition debug/Debug.hpp:131
LIEF::PE::Debug::operator=
Debug & operator=(const Debug &other)=default
LIEF::PE::Debug::type
TYPES type() const
The format DEBUG_TYPES of the debugging information.
Definition debug/Debug.hpp:100
LIEF::PE::Debug::timestamp
void timestamp(uint32_t timestamp)
Definition debug/Debug.hpp:123
LIEF::PE::Debug::Debug
Debug(TYPES type)
Definition debug/Debug.hpp:65
LIEF::PE::Debug::TYPES
TYPES
The entry types.
Definition debug/Debug.hpp:44
LIEF::PE::Parser
Main interface to parse PE binaries. In particular the static functions: Parser::parse should be used...
Definition PE/Parser.hpp:47
LIEF::PE::details
Definition CodeIntegrity.hpp:26
LIEF::PE
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
LIEF::PE::to_string
const char * to_string(DataDirectory::TYPES e)
LIEF
LIEF namespace.
Definition Abstract/Binary.hpp:36
visibility.h
LIEF_API
#define LIEF_API
Definition visibility.h:41