LIEF: Library to Instrument Executable Formats Version 0.16.0
Loading...
Searching...
No Matches
PDB/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_PDB_INFO_H
16#define LIEF_PDB_INFO_H
17#include <memory>
18#include <string>
19
20#include "LIEF/iterators.hpp"
22
25#include "LIEF/PDB/Type.hpp"
26
27#include "LIEF/visibility.h"
28
29namespace LIEF {
30namespace pdb {
31class Function;
32class LIEF_API DebugInfo : public LIEF::DebugInfo {
37 public:
39 using compilation_units_it = iterator_range<CompilationUnit::Iterator>;
42 using public_symbols_it = iterator_range<PublicSymbol::Iterator>;
45 using types_it = iterator_range<Type::Iterator>;
48 static std::unique_ptr<DebugInfo> from_file(const std::string& pdb_path);
52
53 FORMAT format() const override {
55 }
56
57 static bool classof(const LIEF::DebugInfo* info) {
58 return info->format() == LIEF::DebugInfo::FORMAT::PDB;
59 }
60 compilation_units_it compilation_units() const;
64 public_symbols_it public_symbols() const;
67 types_it types() const;
70 std::unique_ptr<Type> find_type(const std::string& name) const;
73 std::unique_ptr<PublicSymbol> find_public_symbol(const std::string& name) const;
85 uint32_t age() const;
88 std::string guid() const;
91
92
93 ~DebugInfo() override = default;
94};
95
96inline std::unique_ptr<DebugInfo> load(const std::string& pdb_path) {
99 return DebugInfo::from_file(pdb_path);
100}
101
102}
103}
104#endif
DebugInfo(std::unique_ptr< details::DebugInfo > impl)
@ PDB
Definition Abstract/DebugInfo.hpp:29
This class provides an interface for PDB files. One can instantiate this class using LIEF::pdb::load(...
Definition PDB/DebugInfo.hpp:36
uint32_t age() const
The number of times the PDB file has been written.
compilation_units_it compilation_units() const
Iterator over the CompilationUnit from the PDB's DBI stream. CompilationUnit are also named "Module" ...
~DebugInfo() override=default
static bool classof(const LIEF::DebugInfo *info)
Definition PDB/DebugInfo.hpp:57
FORMAT format() const override
Definition PDB/DebugInfo.hpp:53
public_symbols_it public_symbols() const
Return an iterator over the public symbol stream.
std::unique_ptr< Type > find_type(const std::string &name) const
Find the type with the given name.
std::unique_ptr< PublicSymbol > find_public_symbol(const std::string &name) const
Try to find the PublicSymbol from the given name (based on the public symbol stream)
static std::unique_ptr< DebugInfo > from_file(const std::string &pdb_path)
Instantiate this class from the given PDB file. It returns a nullptr if the PDB can't be processed.
types_it types() const
Return an iterator over the different types registered in this PDB.
std::string guid() const
Unique identifier of the PDB file.
Definition PDB/Function.hpp:31
Definition PDB/CompilationUnit.hpp:27
std::unique_ptr< DebugInfo > load(const std::string &pdb_path)
Load the PDB file from the given path.
Definition PDB/DebugInfo.hpp:98
LIEF namespace.
Definition Abstract/Binary.hpp:36
#define LIEF_API
Definition visibility.h:41