Browse Source

add events for AppDomain creation and destruction in Debugger

newNRILSpyDebugger
Siegfried Pammer 12 years ago
parent
commit
135a326c85
  1. 8
      src/AddIns/Debugger/Debugger.Core/ManagedCallback.cs
  2. 24
      src/AddIns/Debugger/Debugger.Core/NDebugger.cs
  3. 12
      src/AddIns/Debugger/Debugger.Core/Process.cs

8
src/AddIns/Debugger/Debugger.Core/ManagedCallback.cs

@ -352,7 +352,9 @@ namespace Debugger
EnterCallback("CreateAppDomain", pAppDomain); EnterCallback("CreateAppDomain", pAppDomain);
pAppDomain.Attach(); pAppDomain.Attach();
process.appDomains.Add(new AppDomain(process, pAppDomain)); AppDomain appDomain = new AppDomain(process, pAppDomain);
process.appDomains.Add(appDomain);
process.OnAppDomainCreated(appDomain);
ExitCallback(); ExitCallback();
} }
@ -475,7 +477,9 @@ namespace Debugger
{ {
EnterCallback("ExitAppDomain", pAppDomain); EnterCallback("ExitAppDomain", pAppDomain);
process.appDomains.Remove(process.GetAppDomain(pAppDomain)); AppDomain appDomain = process.GetAppDomain(pAppDomain);
process.appDomains.Remove(appDomain);
process.OnAppDomainDestroyed(appDomain);
ExitCallback(); ExitCallback();
} }

24
src/AddIns/Debugger/Debugger.Core/NDebugger.cs

@ -184,7 +184,7 @@ namespace Debugger
foreach (Process process in this.Processes) { foreach (Process process in this.Processes) {
foreach(Module module in process.Modules) { foreach(Module module in process.Modules) {
breakpoint.SetBreakpoint(module); breakpoint.SetBreakpoint(module);
} }
} }
} }
@ -251,7 +251,7 @@ namespace Debugger
{ {
// Detach all processes. // Detach all processes.
foreach(Process process in this.Processes) { foreach(Process process in this.Processes) {
if (process == null || process.HasExited) if (process == null || process.HasExited)
continue; continue;
process.Detach(); process.Detach();
} }
@ -266,9 +266,9 @@ namespace Debugger
// this option overrides the others // this option overrides the others
return false; return false;
} }
if (systemStartOptions.Contains("/debug") || if (systemStartOptions.Contains("/debug") ||
systemStartOptions.Contains("/crashdebug") || systemStartOptions.Contains("/crashdebug") ||
systemStartOptions.Contains("/debugport") || systemStartOptions.Contains("/debugport") ||
systemStartOptions.Contains("/baudrate")) { systemStartOptions.Contains("/baudrate")) {
return true; return true;
} else { } else {
@ -287,7 +287,7 @@ namespace Debugger
if (!isPaused) if (!isPaused)
process.Break(); process.Break();
// We need to be paused for this // We need to be paused for this
foreach(Module module in process.Modules) { foreach(Module module in process.Modules) {
module.LoadSymbolsFromDisk(this.Options.SymbolsSearchPaths); module.LoadSymbolsFromDisk(this.Options.SymbolsSearchPaths);
module.ResetJustMyCode(); module.ResetJustMyCode();
@ -346,6 +346,18 @@ namespace Debugger
} }
} }
[Serializable]
public class AppDomainEventArgs: DebuggerEventArgs
{
public AppDomain AppDomain { get; private set; }
public AppDomainEventArgs(AppDomain appDomain)
{
this.Process = appDomain.Process;
this.AppDomain = appDomain;
}
}
[Serializable] [Serializable]
public class MessageEventArgs : EventArgs public class MessageEventArgs : EventArgs
{ {

12
src/AddIns/Debugger/Debugger.Core/Process.cs

@ -32,6 +32,8 @@ namespace Debugger
public event EventHandler<MessageEventArgs> LogMessage; public event EventHandler<MessageEventArgs> LogMessage;
public event EventHandler<ModuleEventArgs> ModuleLoaded; public event EventHandler<ModuleEventArgs> ModuleLoaded;
public event EventHandler<ModuleEventArgs> ModuleUnloaded; public event EventHandler<ModuleEventArgs> ModuleUnloaded;
public event EventHandler<AppDomainEventArgs> AppDomainCreated;
public event EventHandler<AppDomainEventArgs> AppDomainDestroyed;
public event EventHandler<DebuggerPausedEventArgs> Paused; public event EventHandler<DebuggerPausedEventArgs> Paused;
public event EventHandler<DebuggerEventArgs> Resumed; public event EventHandler<DebuggerEventArgs> Resumed;
public event EventHandler<DebuggerEventArgs> Exited; public event EventHandler<DebuggerEventArgs> Exited;
@ -603,5 +605,15 @@ namespace Debugger
} }
#endregion #endregion
internal void OnAppDomainCreated(AppDomain appDomain)
{
}
internal void OnAppDomainDestroyed(AppDomain appDomain)
{
}
} }
} }

Loading…
Cancel
Save