public class Keystone extends Object implements AutoCloseable
| 构造器和说明 |
|---|
Keystone(KeystoneArchitecture architecture,
KeystoneMode mode)
Initializes a new instance of the class
Keystone. |
| 限定符和类型 | 方法和说明 |
|---|---|
KeystoneEncoded |
assemble(Iterable<String> assembly)
Assembles a string that contains assembly code.
|
KeystoneEncoded |
assemble(Iterable<String> assembly,
int address)
Assembles a string that contains assembly code, located at a given address location.
|
KeystoneEncoded |
assemble(String assembly)
Assembles a string that contains assembly code.
|
KeystoneEncoded |
assemble(String assembly,
int address)
Assembles a string that contains assembly code, located at a given address location.
|
void |
close()
Closes this resource, relinquishing any underlying resources.
|
static boolean |
isArchitectureSupported(KeystoneArchitecture architecture)
Determines whether the given architecture is supported by Keystone.
|
void |
setAssemblySyntax(KeystoneOptionValue.KeystoneOptionSyntax syntax)
Sets the syntax of the assembly code used in this instance of Keystone.
|
void |
setOption(KeystoneOptionType type,
int value)
Sets an option for Keystone engine at runtime using a not-strongly typed option value.
|
void |
setSymbolResolver(SymbolResolverCallback callback)
Sets a symbol resolver callback, to resolve unrecognized symbols encountered in the assembly code.
|
void |
unsetSymbolResolver()
Unsets the current symbol resolver.
|
Version |
version()
Gets the major and minor version numbers.
|
public Keystone(KeystoneArchitecture architecture, KeystoneMode mode)
Keystone.
Some architectures are not supported. Use the static method isArchitectureSupported(keystone.KeystoneArchitecture) to determine
whether the engine support the architecture.
architecture - The architecture of the code generated by Keystone.mode - The mode type.OpenFailedKeystoneException - if the Keystone library cannot be opened properly.public static boolean isArchitectureSupported(KeystoneArchitecture architecture)
architecture - The architecture type to check.true if the architecture is supported, otherwise false.public KeystoneEncoded assemble(String assembly)
assembly - The assembly instructions. Use ; or \n to separate statements.AssembleFailedKeystoneException - if the assembly code cannot be assembled properly.public KeystoneEncoded assemble(String assembly, int address)
assembly - The assembly instructions. Use ; or \n to separate statements.address - The address of the first assembly instruction.AssembleFailedKeystoneException - if the assembly code cannot be assembled properly.public KeystoneEncoded assemble(Iterable<String> assembly)
assembly - A collection of assembly instructions.AssembleFailedKeystoneException - if the assembly code cannot be assembled properly.public KeystoneEncoded assemble(Iterable<String> assembly, int address)
assembly - A collection of assembly instructions.address - The address of the first assembly instruction.AssembleFailedKeystoneException - if the assembly code cannot be assembled properly.public Version version()
Version, containing the major and minor version numbers.public void setAssemblySyntax(KeystoneOptionValue.KeystoneOptionSyntax syntax)
syntax - The syntax of the assembly code.SetOptionFailedKeystoneException - if the syntax is not supported.SetOptionFailedKeystoneException - if the pair of type and value is not valid.public void setOption(KeystoneOptionType type, int value)
It is suggested to prefer the methods setAssemblySyntax(KeystoneOptionValue.KeystoneOptionSyntax),
setSymbolResolver(SymbolResolverCallback) or unsetSymbolResolver().
type - The type of the option.value - The value of the option.SetOptionFailedKeystoneException - if the pair of type and value is not valid.public void setSymbolResolver(SymbolResolverCallback callback)
If the method is called many times, only the last callback will be triggered.
callback - The symbol resolver callback.SetOptionFailedKeystoneException - if the pair of type and value is not valid.public void unsetSymbolResolver()
SetOptionFailedKeystoneException - if the pair of type and value is not valid.public void close()
try-with-resources statement.
The call to this method is thread-safe.
close 在接口中 AutoCloseableCopyright © 2022. All rights reserved.