C# Class slinject.Debugger.DebugEngine

This is the heart of all injection logic. I'm sorry about its complexity. TODO: refactor it.
The injection is an asynchronous two-step process. It may only occur in FuncEval-safe points. Exceptions are considered to be FE-safe. The class also does support breakpoint FuncEval probbing but if breakpoint is set on optimized method - it's ignored. During first FuncEval call we initialize space in a target process to copy injection assembly code. Once space is initialized we copy code and invoke Assembly.Load() method. After the call is made we look closely at Module Loaded event to find confirmation that our assembly is loaded. When confirmation received we resolve address of the injector method and wait for the second FuncEval-safe event to perform call to injector.
Mostra file Open project: anvaka/slinject Class Usage Examples

Public Methods

Method Description
DebugEngine ( int pid ) : System
SetAssemblyCode ( byte assembly ) : void
Start ( ) : void
Stop ( ) : void

Private Methods

Method Description
CallInjector ( ICorDebugThread thread ) : void
CopyInjectorAssembly ( DebuggerEvalEventArgs e ) : ICorDebugValue
CreateCallback ( ) : ManagedCallback
InitializeDebugger ( ) : void
InvokeAssemblyLoad ( ICorDebugEval2 eval, ICorDebugValue assemblyCodeInTargetProcess ) : void
IsModuleInDomain ( DebugModule module, string domainName ) : bool
OnDebuggerBreakpoint ( object sender, DebuggerBreakpointEventArgs e ) : void
OnDebuggerDomainExited ( object sender, DebuggerDomainExitedEventArgs e ) : void
OnDebuggerEvalCompleted ( object sender, DebuggerEvalEventArgs e ) : void
OnDebuggerEvalFailed ( object sender, DebuggerEvalEventArgs e ) : void
OnDebuggerException ( object sender, DebuggerEventArgs e ) : void
OnDebuggerModuleLoaded ( object sender, DebuggerModuleLoadedEventArgs e ) : void
OnFinished ( ) : void
PerformFuncEval ( ICorDebugThread thread ) : void
PrepareToCopyInjectorAssembly ( ICorDebugThread thread ) : void
ResetOldMscrolibMethods ( ) : void
ResolveNewMscrolibMethods ( DebugModule mscorlib ) : void
SetPotentialBreakpoints ( List breakpoints ) : void
UpdateInjectorFunction ( DebugModule module ) : void

Method Details

DebugEngine() public method

public DebugEngine ( int pid ) : System
pid int
return System

SetAssemblyCode() public method

public SetAssemblyCode ( byte assembly ) : void
assembly byte
return void

Start() public method

public Start ( ) : void
return void

Stop() public method

public Stop ( ) : void
return void