Browse Source

Fixed setting of breakpoints for multiple appdomains

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1639 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 19 years ago
parent
commit
d052929219
  1. 8
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/Breakpoint.cs
  2. 24
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/NDebugger-Breakpoints.cs
  3. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs
  4. 41
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/SourcecodeSegment.cs

8
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/Breakpoint.cs

@ -104,15 +104,11 @@ namespace Debugger @@ -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;
}

24
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/NDebugger-Breakpoints.cs

@ -63,23 +63,25 @@ namespace Debugger @@ -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<BreakpointEventArgs>(OnBreakpointStateChanged);
breakpoint.Hit += new EventHandler<BreakpointEventArgs>(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 @@ -89,13 +91,13 @@ namespace Debugger
{
return AddBreakpoint(new Breakpoint(this, segment, breakpointEnabled));
}
public void RemoveBreakpoint(Breakpoint breakpoint)
{
breakpoint.Changed -= new EventHandler<BreakpointEventArgs>(OnBreakpointStateChanged);
breakpoint.Hit -= new EventHandler<BreakpointEventArgs>(OnBreakpointHit);
breakpoint.Enabled = false;
breakpoint.Enabled = false;
breakpointCollection.Remove( breakpoint );
OnBreakpointRemoved( breakpoint);
}
@ -123,7 +125,7 @@ namespace Debugger @@ -123,7 +125,7 @@ namespace Debugger
collection.AddRange(breakpointCollection);
foreach (Breakpoint b in collection) {
b.SetBreakpoint();
b.SetBreakpoint(e.Module);
}
}
}

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs

@ -331,7 +331,7 @@ namespace Debugger @@ -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) {

41
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/SourcecodeSegment.cs

@ -153,50 +153,27 @@ namespace Debugger @@ -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;

Loading…
Cancel
Save