LIEF: Library to Instrument Executable Formats Version 2.0.0
Loading...
Searching...
No Matches
CodeView.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 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_PE_DEBUG_CODE_VIEW_H
16#define LIEF_PE_DEBUG_CODE_VIEW_H
18
19
20namespace LIEF::PE {
21class Parser;
22class Builder;
23
25class LIEF_API CodeView : public Debug {
26 friend class Parser;
27 friend class Builder;
28
29 public:
32 enum class SIGNATURES {
33 UNKNOWN = 0,
34
35 PDB_70 = 0x53445352, // RSDS
36 PDB_20 = 0x3031424e, // NB10
37 CV_50 = 0x3131424e, // NB11
38 CV_41 = 0x3930424e, // NB09
39 };
40
42 enum class KIND {
43 GENERIC = 0,
44 PDB,
45 };
46
48 Debug(Debug::TYPES::CODEVIEW) {}
49
51 Debug{Debug::TYPES::CODEVIEW},
52 sig_{sig} {}
53
54 CodeView(const details::pe_debug& debug, SIGNATURES sig, Section* sec) :
55 Debug(debug, sec),
56 sig_(sig) {}
57
58 CodeView(const CodeView& other) = default;
59 CodeView& operator=(const CodeView& other) = default;
60
61 CodeView(CodeView&& other) = default;
62 CodeView& operator=(CodeView&& other) = default;
63
64 ~CodeView() override = default;
65
68 return sig_;
69 }
70
72 KIND kind() const {
73 return kind_;
74 }
75
76 std::unique_ptr<Debug> clone() const override {
77 return std::unique_ptr<Debug>(new CodeView(*this));
78 }
79
80 static bool classof(const Debug* debug) {
81 return debug->type() == Debug::TYPES::CODEVIEW;
82 }
83
84 std::string to_string() const override;
85
86 void accept(Visitor& visitor) const override;
87
88 protected:
90 Debug{Debug::TYPES::CODEVIEW},
91 sig_{sig},
92 kind_{kind} {}
93
94 CodeView(KIND kind, const details::pe_debug& debug, SIGNATURES sig,
95 Section* sec) :
96 Debug(debug, sec),
97 sig_(sig),
98 kind_(kind) {}
99
100 SIGNATURES sig_ = SIGNATURES::UNKNOWN;
101 KIND kind_ = KIND::GENERIC;
102};
103
105
106}
107
108#endif
Class that is used to rebuild a raw PE binary from a PE::Binary object.
Definition PE/Builder.hpp:43
Interface for the (generic) Debug CodeView (IMAGE_DEBUG_TYPE_CODEVIEW).
Definition CodeView.hpp:25
SIGNATURES signature() const
The signature that defines the underlying type of the payload.
Definition CodeView.hpp:67
std::unique_ptr< Debug > clone() const override
Definition CodeView.hpp:76
CodeView(CodeView &&other)=default
static bool classof(const Debug *debug)
Definition CodeView.hpp:80
void accept(Visitor &visitor) const override
KIND
Discriminator for the subclasses.
Definition CodeView.hpp:42
CodeView & operator=(const CodeView &other)=default
SIGNATURES
Code view signatures.
Definition CodeView.hpp:32
friend class Builder
Definition CodeView.hpp:27
CodeView & operator=(CodeView &&other)=default
std::string to_string() const override
CodeView(SIGNATURES sig)
Definition CodeView.hpp:50
CodeView(const CodeView &other)=default
friend class Parser
Definition CodeView.hpp:26
CodeView(const details::pe_debug &debug, SIGNATURES sig, Section *sec)
Definition CodeView.hpp:54
CodeView()
Definition CodeView.hpp:47
KIND kind() const
Determine the type of the concrete implementation.
Definition CodeView.hpp:72
~CodeView() override=default
This class represents a generic entry in the debug data directory. For known types,...
Definition debug/Debug.hpp:39
Debug()=default
TYPES
The entry types.
Definition debug/Debug.hpp:45
@ CODEVIEW
CodeView debug information that is used to store PDB info.
Definition debug/Debug.hpp:52
Main interface to parse PE binaries. In particular, the static Parser::parse functions should be used...
Definition PE/Parser.hpp:53
Class which represents a PE section.
Definition PE/Section.hpp:46
Definition Visitor.hpp:211
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:31
const char * to_string(CODE_PAGES e)
#define LIEF_API
Definition visibility.h:44