|
|
|
@ -5,8 +5,8 @@ using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Runtime.InteropServices; |
|
|
|
using System.Runtime.InteropServices; |
|
|
|
|
|
|
|
|
|
|
|
using Debugger.Interop; |
|
|
|
|
|
|
|
using Debugger.Interop.CorDebug; |
|
|
|
using Debugger.Interop.CorDebug; |
|
|
|
|
|
|
|
using Debugger.Interop.CorSym; |
|
|
|
using ICSharpCode.NRefactory.Ast; |
|
|
|
using ICSharpCode.NRefactory.Ast; |
|
|
|
using ICSharpCode.NRefactory.Visitors; |
|
|
|
using ICSharpCode.NRefactory.Visitors; |
|
|
|
|
|
|
|
|
|
|
|
@ -89,6 +89,11 @@ namespace Debugger |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public bool BreakAtBegining { |
|
|
|
|
|
|
|
get; |
|
|
|
|
|
|
|
set; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public AppDomainCollection AppDomains { |
|
|
|
public AppDomainCollection AppDomains { |
|
|
|
get { return appDomains; } |
|
|
|
get { return appDomains; } |
|
|
|
} |
|
|
|
} |
|
|
|
@ -113,6 +118,7 @@ namespace Debugger |
|
|
|
|
|
|
|
|
|
|
|
activeEvals = new EvalCollection(debugger); |
|
|
|
activeEvals = new EvalCollection(debugger); |
|
|
|
modules = new ModuleCollection(debugger); |
|
|
|
modules = new ModuleCollection(debugger); |
|
|
|
|
|
|
|
modules.Added += OnModulesAdded; |
|
|
|
threads = new ThreadCollection(debugger); |
|
|
|
threads = new ThreadCollection(debugger); |
|
|
|
appDomains = new AppDomainCollection(debugger); |
|
|
|
appDomains = new AppDomainCollection(debugger); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -138,21 +144,21 @@ namespace Debugger |
|
|
|
|
|
|
|
|
|
|
|
fixed (uint* pprocessStartupInfo = processStartupInfo) |
|
|
|
fixed (uint* pprocessStartupInfo = processStartupInfo) |
|
|
|
fixed (uint* pprocessInfo = processInfo) |
|
|
|
fixed (uint* pprocessInfo = processInfo) |
|
|
|
outProcess = |
|
|
|
outProcess = |
|
|
|
debugger.CorDebug.CreateProcess( |
|
|
|
debugger.CorDebug.CreateProcess( |
|
|
|
filename, // lpApplicationName
|
|
|
|
filename, // lpApplicationName
|
|
|
|
// If we do not prepend " ", the first argument migh just get lost
|
|
|
|
// If we do not prepend " ", the first argument migh just get lost
|
|
|
|
" " + arguments, // lpCommandLine
|
|
|
|
" " + arguments, // lpCommandLine
|
|
|
|
ref secAttr, // lpProcessAttributes
|
|
|
|
ref secAttr, // lpProcessAttributes
|
|
|
|
ref secAttr, // lpThreadAttributes
|
|
|
|
ref secAttr, // lpThreadAttributes
|
|
|
|
1,//TRUE // bInheritHandles
|
|
|
|
1,//TRUE // bInheritHandles
|
|
|
|
0x00000010 /*CREATE_NEW_CONSOLE*/, // dwCreationFlags
|
|
|
|
0x00000010 /*CREATE_NEW_CONSOLE*/, // dwCreationFlags
|
|
|
|
IntPtr.Zero, // lpEnvironment
|
|
|
|
IntPtr.Zero, // lpEnvironment
|
|
|
|
workingDirectory, // lpCurrentDirectory
|
|
|
|
workingDirectory, // lpCurrentDirectory
|
|
|
|
(uint)pprocessStartupInfo, // lpStartupInfo
|
|
|
|
(uint)pprocessStartupInfo, // lpStartupInfo
|
|
|
|
(uint)pprocessInfo, // lpProcessInformation,
|
|
|
|
(uint)pprocessInfo, // lpProcessInformation,
|
|
|
|
CorDebugCreateProcessFlags.DEBUG_NO_SPECIAL_OPTIONS // debuggingFlags
|
|
|
|
CorDebugCreateProcessFlags.DEBUG_NO_SPECIAL_OPTIONS // debuggingFlags
|
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
return new Process(debugger, outProcess, workingDirectory); |
|
|
|
return new Process(debugger, outProcess, workingDirectory); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -266,7 +272,6 @@ namespace Debugger |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region PauseSession & DebugeeState
|
|
|
|
#region PauseSession & DebugeeState
|
|
|
|
@ -627,5 +632,32 @@ namespace Debugger |
|
|
|
debugger.MTA2STA.PerformAllCalls(); |
|
|
|
debugger.MTA2STA.PerformAllCalls(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Break at begining
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void OnModulesAdded(object sender, CollectionItemEventArgs<Module> e) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (BreakAtBegining) { |
|
|
|
|
|
|
|
if (e.Item.SymReader == null) return; // No symbols
|
|
|
|
|
|
|
|
// create a BP at entry point
|
|
|
|
|
|
|
|
uint entryPoint = e.Item.SymReader.GetUserEntryPoint(); |
|
|
|
|
|
|
|
if (entryPoint == 0) return; // no EP
|
|
|
|
|
|
|
|
var mainFunction = e.Item.CorModule.GetFunctionFromToken(entryPoint); |
|
|
|
|
|
|
|
var corBreakpoint = mainFunction.CreateBreakpoint(); |
|
|
|
|
|
|
|
corBreakpoint.Activate(1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// create a SD BP
|
|
|
|
|
|
|
|
var breakpoint = new Breakpoint(this.debugger, corBreakpoint); |
|
|
|
|
|
|
|
this.debugger.Breakpoints.Add(breakpoint); |
|
|
|
|
|
|
|
breakpoint.Hit += delegate { |
|
|
|
|
|
|
|
if (breakpoint != null) |
|
|
|
|
|
|
|
breakpoint.Remove(); |
|
|
|
|
|
|
|
breakpoint = null; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
BreakAtBegining = false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|