LIEF: Library to Instrument Executable Formats Version 2.0.0
Loading...
Searching...
No Matches
android/Module.hpp
Go to the documentation of this file.
1/* Copyright 2017 - 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_RUNTIME_ANDROID_MODULE_H
16#define LIEF_RUNTIME_ANDROID_MODULE_H
17
20
21namespace LIEF {
22
23namespace ELF {
24class Binary;
25struct ParserConfig;
26}
27
28
29namespace runtime::android {
30
33 public:
35
37 static std::unique_ptr<Module> from_handle(void* H);
38
42 void* handle() const;
43
45 void* dlsym(const std::string& name) const;
46
48 std::unique_ptr<ELF::Binary> parse_from_path() const;
49
52 std::unique_ptr<ELF::Binary>
53 parse_from_path(const ELF::ParserConfig& config) const;
54
56 std::unique_ptr<ELF::Binary>
58
60 std::unique_ptr<ELF::Binary> parse_from_memory() const;
61
62 ~Module() override = default;
63
64 static constexpr bool classof(const runtime::Module*) {
65 return platform() == PLATFORMS::ANDROID_;
66 }
67};
68
70LIEF_API std::unique_ptr<Module> dlopen(const std::string& name);
71
72}
73}
74#endif
Class which represents an ELF binary.
Definition ELF/Binary.hpp:64
This class represents an in-memory module which can be an executable or a library.
Definition Module.hpp:42
std::string name() const
Name of the module (e.g. libc.so.6, kernel32.dll, libsystem_c.dylib).
std::unique_ptr< ELF::Binary > parse_from_path() const
Parse the ELF module from its path on the filesystem.
void * dlsym(const std::string &name) const
Resolve the symbol from with the given name for the current module.
std::unique_ptr< ELF::Binary > parse_from_memory(const ELF::ParserConfig &config) const
Parse the ELF module from memory with the given configuration.
void * handle() const
Return the dlopen handle for this library.
~Module() override=default
std::unique_ptr< ELF::Binary > parse_from_memory() const
Parse the ELF module from memory.
static constexpr bool classof(const runtime::Module *)
Definition android/Module.hpp:64
std::unique_ptr< ELF::Binary > parse_from_path(const ELF::ParserConfig &config) const
Parse the ELF module from its path on the filesystem and given the parser configuration.
static std::unique_ptr< Module > from_handle(void *H)
Instantiate a Module from the given dlopen handle.
Namespace related to the LIEF's ELF module.
Definition Abstract/Header.hpp:27
Definition android/Host.hpp:23
std::unique_ptr< Module > dlopen(const std::string &name)
Load the library with the given path/name.
@ ANDROID_
Definition runtime/utils.hpp:31
LIEF namespace.
Definition Abstract/Binary.hpp:41
This structure is used to tweak the ELF Parser (ELF::Parser).
Definition ELF/ParserConfig.hpp:25
#define LIEF_API
Definition visibility.h:44