Package vtrace :: Module envitools :: Class TraceEmulator
[hide private]
[frames] | no frames]

Class TraceEmulator

source code


Wrap an arbitrary emulator in a Tracer compatible API.

Instance Methods [hide private]
 
__init__(self, emu)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
getPointerSize(self) source code
 
platformStepi(self)
PlatformStepi should be ATOMIC, meaning it gets called, and by the time it returns, you're one step further.
source code
 
platformWait(self)
Wait for something interesting to occur and return a *platform specific* representation of what happened.
source code
 
archGetRegCtx(self)
Return a new empty envi.registers.RegisterContext object for this trace.
source code
 
platformGetRegCtx(self, threadid) source code
 
platformSetRegCtx(self, threadid, ctx) source code
 
platformProcessEvent(self, event)
This method processes the event data provided by platformWait()
source code
 
platformReadMemory(self, va, size) source code
 
platformWriteMemory(self, va, bytes) source code
 
platformGetMaps(self)
Return a list of the memory maps where each element has the following structure: (address, length, perms, file="") NOTE: By Default this list is available as Trace.maps because the default implementation attempts to populate them on every break/stop/etc...
source code
 
platformGetThreads(self)
Return a dictionary of <threadid>:<tinfo> pairs where tinfo is either the stack top, or the teb for win32
source code
 
platformGetFds(self)
Return what getFds() wants for this particular platform
source code
 
getStackTrace(self)
Returns a list of (instruction pointer, stack frame) tuples.
source code
 
platformDetach(self)
Actually perform the detach for this type
source code

Inherited from Trace: addBreakByAddr, addBreakByExpr, addBreakpoint, addIgnoreSignal, allocateMemory, attach, buildNewTrace, call, delIgnoreSignal, deregisterNotifier, detach, disableAutoContinue, enableAutoContinue, execute, getAutoContinueList, getBreakpoint, getBreakpointByAddr, getBreakpointCode, getBreakpointEnabled, getBreakpoints, getCurrentBreakpoint, getCurrentSignal, getCurrentThread, getFds, getMemoryFault, getMemoryMaps, getMeta, getMode, getNormalizedLibNames, getNotifiers, getPid, getRegister, getRegisterContext, getStruct, getStructNames, getSymByAddr, getSymByAddrThunkAware, getSymByName, getSymsForFile, getThreads, getVariable, getVariables, hasExited, hasMeta, hex, injectThread, injectso, isAttached, isRemote, isRunning, isThreadSuspended, joinThread, kill, parseExpression, parseOpcodes, protectMemory, ps, readMemory, registerNotifier, release, removeBreakpoint, requireAttached, requireNotExited, requireNotRunning, resumeThread, run, runAgain, searchMemory, searchMemoryRange, searchSymbols, selectThread, sendBreak, setBreakpointCode, setBreakpointEnabled, setCurrentSignal, setMeta, setMode, setRegister, setSymCachePath, setVariable, stepi, suspendThread, writeMemory

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Inherited from platforms.base.TracerBase: __del__, addLibraryBase, archActivBreakpoint, archAddWatchpoint, archCheckWatchpoints, archClearBreakpoint, archGetStackTrace, archRemWatchpoint, checkBreakpoints, checkPageWatchpoints, checkWatchpoints, delLibraryBase, doStepLoop, fireNotifiers, fireTracerThread, getExe, getResolverForFile, initMode, nextBpId, normFileName, notify, platformAllocateMemory, platformAttach, platformCall, platformContinue, platformExec, platformGetMemFault, platformGetSignal, platformInjectSo, platformInjectThread, platformKill, platformOpenFile, platformParseBinary, platformProtectMemory, platformPs, platformRelease, platformResumeThread, platformSelectThread, platformSetSignal, platformSuspendThread, shouldRunAgain, steploop, wait

Inherited from platforms.base.TracerBase (private): _activBreakpoints, _cacheRegs, _checkForBreakpoint, _cleanupResources, _clearBreakpoints, _doRun, _doWait, _findLibraryMaps, _fireBreakpoint, _fireExit, _fireExitThread, _fireSignal, _fireStep, _justAttached, _loadBinary, _loadBinaryNorm, _simpleCreateThreads, _syncRegs, _tellThreadExit

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, emu)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: platforms.base.TracerBase.__init__
(inherited documentation)

platformStepi(self)

source code 

PlatformStepi should be ATOMIC, meaning it gets called, and by the time it returns, you're one step further. This is completely regardless of blocking/nonblocking/whatever.

Overrides: platforms.base.TracerBase.platformStepi
(inherited documentation)

platformWait(self)

source code 

Wait for something interesting to occur and return a *platform specific* representation of what happened.

This will then be passed to the platformProcessEvent() method which will be responsible for doing things like firing notifiers. Because the platformWait() method needs to be commonly @threadwrap and you can't fire notifiers from within a threadwrapped function...

Overrides: platforms.base.TracerBase.platformWait
(inherited documentation)

archGetRegCtx(self)

source code 

Return a new empty envi.registers.RegisterContext object for this trace.

Overrides: platforms.base.TracerBase.archGetRegCtx
(inherited documentation)

platformGetRegCtx(self, threadid)

source code 
Overrides: platforms.base.TracerBase.platformGetRegCtx

platformSetRegCtx(self, threadid, ctx)

source code 
Overrides: platforms.base.TracerBase.platformSetRegCtx

platformProcessEvent(self, event)

source code 

This method processes the event data provided by platformWait()

This method is responsible for firing ALL notifiers *except*:

vtrace.NOTIFY_CONTINUE - This is handled by the run api (and isn't the result of an event)

Overrides: platforms.base.TracerBase.platformProcessEvent
(inherited documentation)

platformReadMemory(self, va, size)

source code 
Overrides: platforms.base.TracerBase.platformReadMemory

platformWriteMemory(self, va, bytes)

source code 
Overrides: platforms.base.TracerBase.platformWriteMemory

platformGetMaps(self)

source code 

Return a list of the memory maps where each element has the following structure: (address, length, perms, file="") NOTE: By Default this list is available as Trace.maps because the default implementation attempts to populate them on every break/stop/etc...

Overrides: platforms.base.TracerBase.platformGetMaps
(inherited documentation)

platformGetThreads(self)

source code 

Return a dictionary of <threadid>:<tinfo> pairs where tinfo is either the stack top, or the teb for win32

Overrides: platforms.base.TracerBase.platformGetThreads
(inherited documentation)

platformGetFds(self)

source code 

Return what getFds() wants for this particular platform

Overrides: platforms.base.TracerBase.platformGetFds
(inherited documentation)

getStackTrace(self)

source code 

Returns a list of (instruction pointer, stack frame) tuples. If stack tracing results in an error, the error entry will be (-1, -1). Otherwise most platforms end up with 0, 0 as the top stack frame

Overrides: platforms.base.TracerBase.getStackTrace
(inherited documentation)

platformDetach(self)

source code 

Actually perform the detach for this type

Overrides: platforms.base.TracerBase.platformDetach
(inherited documentation)