LIEF: Library to Instrument Executable Formats Version 0.15.1
Loading...
Searching...
No Matches
DWARF/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_DWARF_INFO_H
16#define LIEF_DWARF_INFO_H
17#include <memory>
18#include <string>
19
20#include "LIEF/iterators.hpp"
23
24#include "LIEF/visibility.h"
25
26namespace LIEF {
28namespace dwarf {
29class Function;
30class Variable;
31
37 public:
39
40 static std::unique_ptr<DebugInfo> from_file(const std::string& path);
41
44
56 std::unique_ptr<Function> find_function(const std::string& name) const;
57
59 std::unique_ptr<Function> find_function(uint64_t addr) const;
60
63 std::unique_ptr<Variable> find_variable(const std::string& name) const;
64
66 std::unique_ptr<Variable> find_variable(uint64_t addr) const;
67
69 std::unique_ptr<Type> find_type(const std::string& name) const;
70
73
74 FORMAT format() const override {
76 }
77
78 static bool classof(const LIEF::DebugInfo* info) {
79 return info->format() == LIEF::DebugInfo::FORMAT::DWARF;
80 }
81
82 ~DebugInfo() override = default;
83};
84
85
87inline std::unique_ptr<DebugInfo> load(const std::string& pdb_path) {
88 return DebugInfo::from_file(pdb_path);
89}
90
91}
92}
93#endif
Definition Abstract/DebugInfo.hpp:24
DebugInfo(std::unique_ptr< details::DebugInfo > impl)
FORMAT
Definition Abstract/DebugInfo.hpp:26
virtual FORMAT format() const
Definition Abstract/DebugInfo.hpp:33
This class represents a DWARF debug information. It can embed different compilation units which can b...
Definition DWARF/DebugInfo.hpp:36
static std::unique_ptr< DebugInfo > from_file(const std::string &path)
compilation_units_it compilation_units() const
Iterator on the CompilationUnit embedded in this dwarf.
FORMAT format() const override
Definition DWARF/DebugInfo.hpp:74
std::unique_ptr< Type > find_type(const std::string &name) const
Try to find the type with the given name.
std::unique_ptr< Function > find_function(uint64_t addr) const
Try to find the function at the given virtual address.
std::unique_ptr< Function > find_function(const std::string &name) const
Try to find the function with the given name (mangled or not)
static bool classof(const LIEF::DebugInfo *info)
Definition DWARF/DebugInfo.hpp:78
std::unique_ptr< Variable > find_variable(const std::string &name) const
Try to find the variable with the given name. This name can be mangled or not.
std::unique_ptr< Variable > find_variable(uint64_t addr) const
Try to find the variable at the given virtual address.
~DebugInfo() override=default
Definition iterators.hpp:485
std::unique_ptr< DebugInfo > load(const std::string &pdb_path)
Load DWARF file from the given path.
Definition DWARF/DebugInfo.hpp:87
LIEF namespace.
Definition Abstract/Binary.hpp:32
#define LIEF_API
Definition visibility.h:41