diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/Breakpoint.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/Breakpoint.cs index 738a1de443..ce48c268f9 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/Breakpoint.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/Breakpoint.cs @@ -104,15 +104,11 @@ namespace Debugger HadBeenSet = false; } - public bool SetBreakpoint() + public bool SetBreakpoint(Module module) { - if (hadBeenSet) { - return true; - } - ICorDebugFunction corFunction; int ilOffset; - if (!sourcecodeSegment.GetFunctionAndOffset(debugger, false, out corFunction, out ilOffset)) { + if (!sourcecodeSegment.GetFunctionAndOffset(module, false, out corFunction, out ilOffset)) { return false; } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/NDebugger-Breakpoints.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/NDebugger-Breakpoints.cs index 6d79cc8a39..e65fe4b27e 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/NDebugger-Breakpoints.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/NDebugger-Breakpoints.cs @@ -63,23 +63,25 @@ namespace Debugger return breakpoint; } } - + throw new DebuggerException("Breakpoint is not in collection"); } - + internal Breakpoint AddBreakpoint(Breakpoint breakpoint) { breakpointCollection.Add(breakpoint); - - breakpoint.SetBreakpoint(); + + foreach(Module module in this.Modules) { + breakpoint.SetBreakpoint(module); + } breakpoint.Changed += new EventHandler(OnBreakpointStateChanged); breakpoint.Hit += new EventHandler(OnBreakpointHit); - + OnBreakpointAdded(breakpoint); - + return breakpoint; } - + public Breakpoint AddBreakpoint(string filename, int line) { return AddBreakpoint(new SourcecodeSegment(filename, line), true); @@ -89,13 +91,13 @@ namespace Debugger { return AddBreakpoint(new Breakpoint(this, segment, breakpointEnabled)); } - + public void RemoveBreakpoint(Breakpoint breakpoint) { breakpoint.Changed -= new EventHandler(OnBreakpointStateChanged); breakpoint.Hit -= new EventHandler(OnBreakpointHit); - - breakpoint.Enabled = false; + + breakpoint.Enabled = false; breakpointCollection.Remove( breakpoint ); OnBreakpointRemoved( breakpoint); } @@ -123,7 +125,7 @@ namespace Debugger collection.AddRange(breakpointCollection); foreach (Breakpoint b in collection) { - b.SetBreakpoint(); + b.SetBreakpoint(e.Module); } } } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs index f2e617ee67..920baf12c5 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs @@ -331,7 +331,7 @@ namespace Debugger SourcecodeSegment suggestion = new SourcecodeSegment(filename, line, column, column); ICorDebugFunction corFunction; int ilOffset; - if (!suggestion.GetFunctionAndOffset(debugger, false, out corFunction, out ilOffset)) { + if (!suggestion.GetFunctionAndOffset(this.Module, false, out corFunction, out ilOffset)) { return null; } else { if (corFunction.Token != methodProps.Token) { diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/SourcecodeSegment.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/SourcecodeSegment.cs index 670833fcd0..5a2134d4d2 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/SourcecodeSegment.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/SourcecodeSegment.cs @@ -153,50 +153,27 @@ namespace Debugger } // Returns true if found - internal bool GetFunctionAndOffset(NDebugger debugger, bool normailize, out ICorDebugFunction function, out int ilOffset) + internal bool GetFunctionAndOffset(Module module, bool normailize, out ICorDebugFunction function, out int ilOffset) { function = null; ilOffset = 0; - Module module = null; - ISymUnmanagedReader symReader = null; - ISymUnmanagedDocument symDoc = null; - - // Try to get doc from moduleFilename - if (moduleFilename != null) { - try { - module = debugger.GetModule(ModuleFilename); - symReader = module.SymReader; - symDoc = symReader.GetDocument(SourceFullFilename,Guid.Empty,Guid.Empty,Guid.Empty); - } catch {} - } - - // search all modules - if (symDoc == null) { - foreach (Module m in debugger.Modules) { - module = m; - symReader = m.SymReader; - if (symReader == null) { - continue; - } - - symDoc = symReader.GetDocument(SourceFullFilename,Guid.Empty,Guid.Empty,Guid.Empty); - - if (symDoc != null) { - break; - } - } + ISymUnmanagedReader symReader = module.SymReader; + if (symReader == null) { + return false; // No symbols } - + + ISymUnmanagedDocument symDoc = null; + symDoc = symReader.GetDocument(SourceFullFilename, Guid.Empty, Guid.Empty, Guid.Empty); if (symDoc == null) { - return false; //Not found + return false; // Does not use source file } uint validLine; try { validLine = symDoc.FindClosestLine((uint)StartLine); } catch { - return false; //Not found + return false; // Not on a vaild point } if (validLine != StartLine && normailize) { StartLine = (int)validLine;