LIEF: Library to Instrument Executable Formats
Version 2.0.0
Toggle main menu visibility
Loading...
Searching...
No Matches
lief-install
x86_64
static
include
LIEF
MachO
MainCommand.hpp
Go to the documentation of this file.
1
/* Copyright 2017 - 2026 R. Thomas
2
* Copyright 2017 - 2026 Quarkslab
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
#ifndef LIEF_MACHO_MAIN_COMMAND_H
17
#define LIEF_MACHO_MAIN_COMMAND_H
18
#include <memory>
19
#include <ostream>
20
21
#include "
LIEF/visibility.h
"
22
23
#include "
LIEF/MachO/LoadCommand.hpp
"
24
25
26
namespace
LIEF::MachO
{
27
28
namespace
details
{
29
struct
entry_point_command;
30
}
31
34
class
LIEF_API
MainCommand
:
public
LoadCommand
{
35
public
:
36
MainCommand
() =
default
;
37
MainCommand
(
const
details::entry_point_command& cmd);
38
MainCommand
(uint64_t
entrypoint
, uint64_t stacksize);
39
40
MainCommand
&
operator=
(
const
MainCommand
& copy) =
default
;
41
MainCommand
(
const
MainCommand
& copy) =
default
;
42
43
std::unique_ptr<LoadCommand>
clone
()
const override
{
44
return
std::make_unique<MainCommand>(*
this
);
45
}
46
47
~MainCommand
()
override
=
default
;
48
51
uint64_t
entrypoint
()
const
{
52
return
entrypoint_;
53
}
54
56
uint64_t
stack_size
()
const
{
57
return
stack_size_;
58
}
59
60
void
entrypoint
(uint64_t
entrypoint
) {
61
entrypoint_ =
entrypoint
;
62
}
63
void
stack_size
(uint64_t stacksize) {
64
stack_size_ = stacksize;
65
}
66
67
std::ostream&
print
(std::ostream& os)
const override
;
68
69
void
accept
(
Visitor
& visitor)
const override
;
70
71
static
bool
classof
(
const
LoadCommand
* cmd) {
72
return
cmd->
command
() ==
LoadCommand::TYPE::MAIN
;
73
}
74
75
private
:
76
uint64_t entrypoint_ = 0;
77
uint64_t stack_size_ = 0;
78
};
79
80
}
81
82
#endif
LoadCommand.hpp
LIEF::MachO::LoadCommand::LoadCommand
LoadCommand()=default
LIEF::MachO::LoadCommand::command
LoadCommand::TYPE command() const
Command type.
Definition
LoadCommand.hpp:132
LIEF::MachO::LoadCommand::TYPE::MAIN
@ MAIN
Definition
LoadCommand.hpp:89
LIEF::MachO::MainCommand::entrypoint
uint64_t entrypoint() const
Offset of the main function relative to the __TEXT segment.
Definition
MainCommand.hpp:51
LIEF::MachO::MainCommand::MainCommand
MainCommand(const MainCommand ©)=default
LIEF::MachO::MainCommand::MainCommand
MainCommand()=default
LIEF::MachO::MainCommand::entrypoint
void entrypoint(uint64_t entrypoint)
Definition
MainCommand.hpp:60
LIEF::MachO::MainCommand::MainCommand
MainCommand(uint64_t entrypoint, uint64_t stacksize)
LIEF::MachO::MainCommand::stack_size
uint64_t stack_size() const
The initial stack size.
Definition
MainCommand.hpp:56
LIEF::MachO::MainCommand::clone
std::unique_ptr< LoadCommand > clone() const override
Definition
MainCommand.hpp:43
LIEF::MachO::MainCommand::~MainCommand
~MainCommand() override=default
LIEF::MachO::MainCommand::MainCommand
MainCommand(const details::entry_point_command &cmd)
LIEF::MachO::MainCommand::print
std::ostream & print(std::ostream &os) const override
LIEF::MachO::MainCommand::accept
void accept(Visitor &visitor) const override
LIEF::MachO::MainCommand::stack_size
void stack_size(uint64_t stacksize)
Definition
MainCommand.hpp:63
LIEF::MachO::MainCommand::classof
static bool classof(const LoadCommand *cmd)
Definition
MainCommand.hpp:71
LIEF::MachO::MainCommand::operator=
MainCommand & operator=(const MainCommand ©)=default
LIEF::Visitor
Definition
Visitor.hpp:212
LIEF::MachO::details
Definition
endianness_support.hpp:59
LIEF::MachO
Namespace related to the LIEF's Mach-O module.
Definition
Abstract/Header.hpp:36
visibility.h
LIEF_API
#define LIEF_API
Definition
visibility.h:45
Generated by
1.18.0