public abstract class AbstractEmulator<T extends NewFileIO> extends Object implements Emulator<T>, MemoryWriteListener
| Modifier and Type | Field and Description |
|---|---|
protected Backend |
backend |
protected DateFormat |
dateFormat |
static long |
DEFAULT_TIMEOUT |
protected SvcMemory |
svcMemory |
protected long |
timeout |
| Constructor and Description |
|---|
AbstractEmulator(boolean is64Bit,
String processName,
long svcBase,
int svcSize,
File rootDir,
Family family,
Collection<BackendFactory> backendFactories) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract byte[] |
assemble(Iterable<String> assembly) |
Debugger |
attach() |
Debugger |
attach(DebuggerType type) |
void |
close() |
protected abstract void |
closeInternal() |
protected abstract Debugger |
createConsoleDebugger() |
protected abstract Dlfcn |
createDyld(SvcMemory svcMemory) |
protected abstract FileSystem<T> |
createFileSystem(File rootDir) |
protected abstract Memory |
createMemory(UnixSyscallHandler<T> syscallHandler,
String[] envs) |
protected abstract RegisterContext |
createRegisterContext(Backend backend) |
protected abstract UnixSyscallHandler<T> |
createSyscallHandler(SvcMemory svcMemory) |
protected ThreadDispatcher |
createThreadDispatcher() |
protected void |
dumpClass(String className) |
protected void |
dumpGPBProtobufMsg(String className) |
Number |
emulate(long begin,
long until) |
boolean |
emulateSignal(int sig)
emulate signal handler
|
<V> V |
get(String key) |
Backend |
getBackend() |
<V extends RegisterContext> |
getContext() |
Family |
getFamily() |
FileSystem<T> |
getFileSystem() |
int |
getPageAlign() |
protected abstract int |
getPageAlignInternal() |
int |
getPid() |
String |
getProcessName() |
abstract com.sun.jna.Pointer |
getStackPointer() |
SvcMemory |
getSvcMemory() |
ThreadDispatcher |
getThreadDispatcher() |
boolean |
is32Bit() |
boolean |
is64Bit() |
protected abstract boolean |
isPaddingArgument() |
boolean |
isRunning()
是否正在运行
|
void |
onSystemWrite(long addr,
byte[] data) |
int |
popContext() |
void |
pushContext(int off) |
protected Number |
runMainForResult(MainTask task) |
protected void |
searchClass(String keywords) |
void |
serialize(DataOutput out) |
void |
set(String key,
Object value) |
void |
setTimeout(long timeout) |
void |
setTraceSystemMemoryWrite(long begin,
long end,
TraceSystemMemoryWriteListener listener) |
TraceHook |
traceCode()
trace instruction
note: low performance
|
TraceHook |
traceCode(long begin,
long end) |
TraceHook |
traceCode(long begin,
long end,
TraceCodeListener listener) |
TraceHook |
traceRead()
trace memory read
|
TraceHook |
traceRead(long begin,
long end) |
TraceHook |
traceRead(long begin,
long end,
TraceReadListener listener) |
TraceHook |
traceWrite()
trace memory write
|
TraceHook |
traceWrite(long begin,
long end) |
TraceHook |
traceWrite(long begin,
long end,
TraceWriteListener listener) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateURLibraryFile, dumpGPBProtobufDef, dumpObjcClass, eEntry, eFunc, getDlfcn, getMemory, getObjcClassName, getPointerSize, getReturnAddress, getSyscallHandler, getUnwinder, loadLibrary, loadLibrary, showRegs, showRegs, traceMemoryLeaksdisassemble, disassemble, printAssemblepublic static final long DEFAULT_TIMEOUT
protected final Backend backend
protected long timeout
protected final SvcMemory svcMemory
protected final DateFormat dateFormat
public AbstractEmulator(boolean is64Bit,
String processName,
long svcBase,
int svcSize,
File rootDir,
Family family,
Collection<BackendFactory> backendFactories)
protected ThreadDispatcher createThreadDispatcher()
public final int getPageAlign()
getPageAlign in interface Emulator<T extends NewFileIO>protected abstract int getPageAlignInternal()
public Family getFamily()
public final SvcMemory getSvcMemory()
getSvcMemory in interface Emulator<T extends NewFileIO>public final FileSystem<T> getFileSystem()
getFileSystem in interface Emulator<T extends NewFileIO>protected abstract FileSystem<T> createFileSystem(File rootDir)
protected abstract RegisterContext createRegisterContext(Backend backend)
public <V extends RegisterContext> V getContext()
getContext in interface Emulator<T extends NewFileIO>protected abstract Memory createMemory(UnixSyscallHandler<T> syscallHandler, String[] envs)
protected abstract UnixSyscallHandler<T> createSyscallHandler(SvcMemory svcMemory)
public Debugger attach(DebuggerType type)
protected abstract Debugger createConsoleDebugger()
public final TraceHook traceRead(long begin, long end)
public TraceHook traceRead(long begin, long end, TraceReadListener listener)
public final TraceHook traceWrite(long begin, long end)
traceWrite in interface Emulator<T extends NewFileIO>public void setTraceSystemMemoryWrite(long begin,
long end,
TraceSystemMemoryWriteListener listener)
setTraceSystemMemoryWrite in interface Emulator<T extends NewFileIO>public void onSystemWrite(long addr,
byte[] data)
onSystemWrite in interface MemoryWriteListenerpublic TraceHook traceWrite(long begin, long end, TraceWriteListener listener)
traceWrite in interface Emulator<T extends NewFileIO>public final TraceHook traceRead()
Emulatorpublic final TraceHook traceWrite()
EmulatortraceWrite in interface Emulator<T extends NewFileIO>public final TraceHook traceCode()
Emulatorpublic final TraceHook traceCode(long begin, long end)
public TraceHook traceCode(long begin, long end, TraceCodeListener listener)
public void setTimeout(long timeout)
setTimeout in interface Emulator<T extends NewFileIO>timeout - Duration to emulate the code (in microseconds). When this value is 0, we will emulate the code in infinite time, until the code is finished.public boolean isRunning()
Emulatorpublic ThreadDispatcher getThreadDispatcher()
getThreadDispatcher in interface Emulator<T extends NewFileIO>public boolean emulateSignal(int sig)
EmulatoremulateSignal in interface Emulator<T extends NewFileIO>sig - signal numbertrue means called handler function.public final Number emulate(long begin, long until) throws PopContextException
null表示执行未完成,需要线程调度PopContextExceptionpublic abstract com.sun.jna.Pointer getStackPointer()
public final void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionprotected abstract void closeInternal()
public Backend getBackend()
getBackend in interface Emulator<T extends NewFileIO>public String getProcessName()
getProcessName in interface Emulator<T extends NewFileIO>protected abstract boolean isPaddingArgument()
protected void dumpClass(String className)
protected void searchClass(String keywords)
protected void dumpGPBProtobufMsg(String className)
public final void serialize(DataOutput out) throws IOException
serialize in interface SerializableIOExceptionpublic void pushContext(int off)
pushContext in interface Emulator<T extends NewFileIO>public int popContext()
popContext in interface Emulator<T extends NewFileIO>Copyright © 2026. All rights reserved.