LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
Abstract/DebugInfo.hpp
Go to the documentation of this file.
1/* Copyright 2022 - 2024 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 "LIEF/visibility.h"
19namespace LIEF {
20
21namespace details {
22class DebugInfo;
23}
24
26 public:
27 enum class FORMAT {
28 UNKNOWN = 0,
29 DWARF, PDB,
30 };
31 DebugInfo(std::unique_ptr<details::DebugInfo> impl);
32
33 virtual ~DebugInfo();
34
35 virtual FORMAT format() const {
36 return FORMAT::UNKNOWN;
37 }
38 template<class T>
48 const T* as() const {
49 static_assert(std::is_base_of<DebugInfo, T>::value,
50 "Require Instruction inheritance");
51 if (T::classof(this)) {
52 return static_cast<const T*>(this);
53 }
54 return nullptr;
55 }
56
57 protected:
58 std::unique_ptr<details::DebugInfo> impl_;
59};
60
61}
62#endif
Definition Abstract/DebugInfo.hpp:25
DebugInfo(std::unique_ptr< details::DebugInfo > impl)
virtual ~DebugInfo()
const T * as() const
This function can be used to down cast a DebugInfo instance:
Definition Abstract/DebugInfo.hpp:48
virtual FORMAT format() const
Definition Abstract/DebugInfo.hpp:35
Definition Abstract/DebugInfo.hpp:21
LIEF namespace.
Definition Abstract/Binary.hpp:36
#define LIEF_API
Definition visibility.h:41