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

Class TraceEmulator

source code

           envi.memory.IMemory --+    
                                 |    
envi.registers.RegisterContext --+    
                                 |    
  envi.resolver.SymbolResolver --+    
                                 |    
                        object --+    
                                 |    
                             Trace --+
                                     |
                    object --+       |
                             |       |
            notifiers.Notifier --+   |
                                 |   |
         platforms.base.TracerBase --+
                                     |
                                    TraceEmulator

Wrap an arbitrary emulator in a Tracer compatible API.

Instance Methods [hide private]
 
__init__(self, emu)
Hand in a register definition which consists of a list of (<name>, <width>) tuples.
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, getSymByName, getSymsForFile, getThreads, getVariable, getVariables, hasMeta, hex, injectThread, injectso, isAttached, isRemote, isRunning, isThreadSuspended, joinThread, kill, parseExpression, protectMemory, ps, readMemory, registerNotifier, release, removeBreakpoint, requireAttached, requireNotExited, requireNotRunning, resumeThread, run, runAgain, searchMemory, searchMemoryRange, searchSymbols, selectThread, sendBreak, setBreakpointCode, setBreakpointEnabled, setCurrentSignal, setMeta, setMode, setRegister, setVariable, stepi, suspendThread, writeMemory

Inherited from envi.memory.IMemory: addMemoryMap, getMemoryMap, getSegmentInfo, isExecutable, isReadable, isShared, isValidPointer, isWriteable, parseOpcode, probeMemory, readMemValue, readMemoryFormat, writeMemoryFormat

Inherited from envi.registers.RegisterContext: addMetaRegister, getMetaRegInfo, getProgramCounter, getRegDef, getRegisterByName, getRegisterIndex, getRegisterInfo, getRegisterName, getRegisterNameIndexes, getRegisterNames, getRegisterSnap, getRegisterWidth, getRegisters, getStackCounter, isDirty, isMetaRegister, loadRegDef, loadRegMetas, reprRegister, setIsDirty, setProgramCounter, setRegisterByName, setRegisterIndexes, setRegisterInfo, setRegisterSnap, setRegisters, setStackCounter

Inherited from envi.resolver.SymbolResolver: addSymbol, delSymbol, getSymHint, getSymList

Inherited from platforms.base.TracerBase: __del__, __repr__, addLibraryBase, archAddWatchpoint, archCheckWatchpoints, 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 notifiers.Notifier: handleEvent

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, emu)
(Constructor)

source code 

Hand in a register definition which consists of a list of (<name>, <width>) tuples.

Overrides: object.__init__
(inherited documentation)

getPointerSize(self)

source code 
Overrides: envi.memory.IMemory.getPointerSize

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)