Go to the documentation of this file.
15#ifndef LIEF_DWARF_COMPILATION_UNIT_H
16#define LIEF_DWARF_COMPILATION_UNIT_H
32class CompilationUnitIt;
40 using iterator_category = std::bidirectional_iterator_tag;
41 using value_type = std::unique_ptr<CompilationUnit>;
42 using difference_type = std::ptrdiff_t;
43 using pointer = CompilationUnit*;
44 using reference = std::unique_ptr<CompilationUnit>&;
45 using implementation = details::CompilationUnitIt;
49 friend class Iterator;
56 template <
typename RefT>
57 PointerProxy(RefT &&R) : R(std::forward<RefT>(R)) {}
62 Iterator(std::unique_ptr<details::CompilationUnitIt> impl);
65 friend
LIEF_API bool operator==(const Iterator& LHS, const Iterator& RHS);
66 friend
LIEF_API bool operator!=(const Iterator& LHS, const Iterator& RHS) {
74 Iterator tmp = *
static_cast<Iterator*
>(
this);
75 --*
static_cast<Iterator *
>(
this);
80 Iterator tmp = *
static_cast<Iterator*
>(
this);
81 ++*
static_cast<Iterator *
>(
this);
88 return static_cast<const Iterator*
>(
this)->
operator*();
92 std::unique_ptr<details::CompilationUnitIt> impl_;
94 using functions_it = iterator_range<Function::Iterator>;
97 using types_it = iterator_range<Type::Iterator>;
100 using vars_it = iterator_range<Variable::Iterator>;
111 enum LANG : uint32_t {
127 uint32_t version = 0;
133 lang(lang), version(version)
147 std::string
name()
const;
182 uint64_t
size()
const;
192 std::vector<range_t>
ranges()
const;
198 std::unique_ptr<Function>
find_function(
const std::string& name)
const;
203 std::unique_ptr<Function>
find_function(uint64_t addr)
const;
206 std::unique_ptr<Variable>
find_variable(uint64_t addr)
const;
209 std::unique_ptr<Variable>
find_variable(
const std::string& name)
const;
255 types_it
types()
const;
276 std::unique_ptr<details::CompilationUnit> impl_;
pointer operator->() const
Definition DWARF/CompilationUnit.hpp:51
Iterator(const Iterator &)
Iterator(Iterator &&) noexcept
Iterator operator--(int)
Definition DWARF/CompilationUnit.hpp:73
std::unique_ptr< CompilationUnit > operator*() const
Iterator operator++(int)
Definition DWARF/CompilationUnit.hpp:79
PointerProxy operator->() const
Definition DWARF/CompilationUnit.hpp:87
Language(LANG lang)
Definition DWARF/CompilationUnit.hpp:135
Language(Language &&)=default
Language(LANG lang, uint32_t version)
Definition DWARF/CompilationUnit.hpp:132
Language & operator=(Language &&)=default
Language(const Language &)=default
Language & operator=(const Language &)=default
This class represents a DWARF compilation unit.
Definition DWARF/CompilationUnit.hpp:36
uint64_t high_address() const
Return the highest virtual address owned by this compilation unit.
vars_it variables() const
Return an iterator over all the variables defined in the this compilation unit:
types_it types() const
Return an iterator over the different types defined in this compilation unit.
Language language() const
Original Language of this compilation unit.
std::unique_ptr< Variable > find_variable(const std::string &name) const
Try to find the Variable with the given name.
CompilationUnit(std::unique_ptr< details::CompilationUnit > impl)
std::unique_ptr< Function > find_function(uint64_t addr) const
Try to find the function at the given address.
uint64_t size() const
Return the size of the compilation unit according to its range of address.
functions_it imported_functions() const
Return an iterator over the functions imported in this compilation unit but not implemented.
uint64_t low_address() const
Return the lowest virtual address owned by this compilation unit.
std::string name() const
Name of the file associated with this compilation unit (e.g. test.cpp) Return an empty string if the ...
std::string compilation_dir() const
Return the path to the directory in which the compilation took place for compiling this compilation u...
functions_it functions() const
Return an iterator over the functions implemented in this compilation unit.
std::unique_ptr< Function > find_function(const std::string &name) const
Try to find the function whose name is given in parameter.
std::unique_ptr< Variable > find_variable(uint64_t addr) const
Try to find the Variable at the given address.
std::string producer() const
Information about the program (or library) that generated this compilation unit. For instance,...
std::vector< range_t > ranges() const
Return a list of address ranges owned by this compilation unit.
Definition DWARF/CompilationUnit.hpp:30
Namespace for the DWARF debug format.
Definition DWARF/CompilationUnit.hpp:28
LIEF namespace.
Definition Abstract/Binary.hpp:36
#define LIEF_API
Definition visibility.h:41