Browse Source

Set breakpoints for the correct module

pull/191/merge
Eusebiu Marcu 15 years ago
parent
commit
08de76c699
  1. 7
      Debugger/Debugger.Core/BreakpointCollection.cs
  2. 4
      Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs

7
Debugger/Debugger.Core/BreakpointCollection.cs

@ -54,6 +54,11 @@ namespace Debugger @@ -54,6 +54,11 @@ namespace Debugger
{
foreach(Process process in this.Debugger.Processes) {
foreach(Module module in process.Modules) {
var currentModuleTypes = module.GetNamesOfDefinedTypes();
// set the breakpoint only if the module contains the type
if (!currentModuleTypes.Contains(breakpoint.TypeName))
continue;
breakpoint.SetBreakpoint(module);
}
}
@ -80,7 +85,7 @@ namespace Debugger @@ -80,7 +85,7 @@ namespace Debugger
base.OnRemoved(breakpoint);
}
internal void SetInModule(Module module)
internal void SetInModule(Module module)
{
// This is in case that the client modifies the collection as a response to set breakpoint
// NB: If client adds new breakpoint, it will be set directly as a result of his call, not here (because module is already loaded)

4
Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs

@ -746,12 +746,16 @@ namespace ILSpy.Debugger.Services @@ -746,12 +746,16 @@ namespace ILSpy.Debugger.Services
void debuggedProcess_ModulesAdded(object sender, ModuleEventArgs e)
{
var currentModuleTypes = e.Module.GetNamesOfDefinedTypes();
foreach (var bookmark in DebuggerService.Breakpoints) {
var breakpoint =
debugger.Breakpoints.FirstOrDefault(
b => b.Line == bookmark.LineNumber && b.TypeName == bookmark.Type.FullName);
if (breakpoint == null)
continue;
// set the breakpoint only if the module contains the type
if (!currentModuleTypes.Contains(breakpoint.TypeName))
continue;
breakpoint.SetBreakpoint(e.Module);
}

Loading…
Cancel
Save