LIEF: Library to Instrument Executable Formats
Version 1.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
lief-install
x86_64
static
include
LIEF
asm
Engine.hpp
Go to the documentation of this file.
1
/* Copyright 2022 - 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_ASM_ENGINE_H
16
#define LIEF_ASM_ENGINE_H
17
#include "
LIEF/visibility.h
"
18
#include "
LIEF/iterators.hpp
"
19
#include "
LIEF/compiler_attributes.hpp
"
20
21
#include "
LIEF/asm/Instruction.hpp
"
22
#include "
LIEF/asm/AssemblerConfig.hpp
"
23
24
#include <memory>
25
26
namespace
LIEF
{
27
class
Binary
;
28
30
namespace
assembly
{
31
32
namespace
details
{
33
class
Engine
;
34
}
35
37
class
LIEF_API
Engine
{
38
public
:
40
using
instructions_it
=
iterator_range<Instruction::Iterator>
;
41
42
Engine
() =
delete
;
43
Engine
(std::unique_ptr<details::Engine> impl);
44
45
Engine
(
const
Engine
&) =
delete
;
46
Engine
&
operator=
(
const
Engine
&) =
delete
;
47
48
Engine
(
Engine
&&) noexcept;
49
Engine
& operator=(
Engine
&&) noexcept;
50
53
instructions_it
disassemble
(const uint8_t* buffer,
size_t
size, uint64_t addr);
54
57
instructions_it
disassemble
(const std::vector<uint8_t>& bytes, uint64_t addr) {
58
return
disassemble
(bytes.data(), bytes.size(), addr);
59
}
60
61
std::vector<uint8_t>
62
assemble
(uint64_t address,
const
std::string& Asm,
63
AssemblerConfig
& config =
AssemblerConfig::default_config
());
64
65
std::vector<uint8_t>
66
assemble
(uint64_t address,
const
std::string& Asm,
LIEF::Binary
& bin,
67
AssemblerConfig
& config =
AssemblerConfig::default_config
());
68
69
std::vector<uint8_t>
assemble
(
const
llvm::MCInst& inst);
70
71
std::vector<uint8_t>
assemble
(
const
std::vector<llvm::MCInst>& inst);
72
73
~Engine
();
74
76
LIEF_LOCAL
const
details::Engine& impl() const
LIEF_LIFETIMEBOUND
{
77
assert(impl_ !=
nullptr
);
78
return
*impl_;
79
}
80
82
LIEF_LOCAL
details::Engine& impl()
LIEF_LIFETIMEBOUND
{
83
assert(impl_ !=
nullptr
);
84
return
*impl_;
85
}
86
87
private
:
88
std::unique_ptr<details::Engine> impl_;
89
};
90
}
91
}
92
93
#endif
AssemblerConfig.hpp
Instruction.hpp
LIEF::Binary
Generic interface representing a binary executable.
Definition
Abstract/Binary.hpp:60
LIEF::assembly::AssemblerConfig
This class exposes the different elements that can be configured to assemble code.
Definition
AssemblerConfig.hpp:29
LIEF::assembly::AssemblerConfig::default_config
static AssemblerConfig & default_config()
Default configuration.
Definition
AssemblerConfig.hpp:50
LIEF::assembly::Engine
This class interfaces the assembler/disassembler support.
Definition
Engine.hpp:37
LIEF::assembly::Engine::Engine
Engine(const Engine &)=delete
LIEF::assembly::Engine::assemble
std::vector< uint8_t > assemble(const std::vector< llvm::MCInst > &inst)
LIEF::assembly::Engine::operator=
Engine & operator=(const Engine &)=delete
LIEF::assembly::Engine::Engine
Engine()=delete
LIEF::assembly::Engine::Engine
Engine(std::unique_ptr< details::Engine > impl)
LIEF::assembly::Engine::Engine
Engine(Engine &&) noexcept
LIEF::assembly::Engine::assemble
std::vector< uint8_t > assemble(uint64_t address, const std::string &Asm, LIEF::Binary &bin, AssemblerConfig &config=AssemblerConfig::default_config())
LIEF::assembly::Engine::instructions_it
iterator_range< Instruction::Iterator > instructions_it
Disassembly instruction iterator.
Definition
Engine.hpp:40
LIEF::assembly::Engine::disassemble
instructions_it disassemble(const uint8_t *buffer, size_t size, uint64_t addr)
Disassemble the provided buffer with the address specified in the second parameter.
LIEF::assembly::Engine::assemble
std::vector< uint8_t > assemble(const llvm::MCInst &inst)
LIEF::assembly::Engine::assemble
std::vector< uint8_t > assemble(uint64_t address, const std::string &Asm, AssemblerConfig &config=AssemblerConfig::default_config())
LIEF::assembly::Engine::~Engine
~Engine()
LIEF::iterator_range
Definition
iterators.hpp:603
compiler_attributes.hpp
LIEF_LIFETIMEBOUND
#define LIEF_LIFETIMEBOUND
Definition
compiler_attributes.hpp:72
iterators.hpp
LIEF::assembly::details
Definition
Engine.hpp:32
LIEF::assembly
Namespace related to assembly/disassembly support.
Definition
Abstract/Binary.hpp:48
LIEF
LIEF namespace.
Definition
Abstract/Binary.hpp:41
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:45
LIEF_LOCAL
#define LIEF_LOCAL
Definition
visibility.h:46
Generated by
1.17.0