Browse Source

Created public constructors for SourcecodeSegment, changes in Breakpoint.cs

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@198 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 21 years ago
parent
commit
3c0ffd30f8
  1. 2
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs
  2. 80
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/Breakpoint.cs
  3. 24
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/NDebugger-Breakpoints.cs
  4. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs
  5. 1
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs
  6. 38
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/SourcecodeSegment.cs

2
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs

@ -298,7 +298,7 @@ namespace ICSharpCode.SharpDevelop.Services
{ {
debugger.ClearBreakpoints(); debugger.ClearBreakpoints();
foreach (ICSharpCode.Core.Breakpoint b in DebuggerService.Breakpoints) { foreach (ICSharpCode.Core.Breakpoint b in DebuggerService.Breakpoints) {
DebuggerLibrary.Breakpoint newBreakpoint = debugger.AddBreakpoint(b.FileName, b.LineNumber, 0, b.IsEnabled); DebuggerLibrary.Breakpoint newBreakpoint = debugger.AddBreakpoint(new SourcecodeSegment(b.FileName, b.LineNumber), b.IsEnabled);
b.Tag = newBreakpoint; b.Tag = newBreakpoint;
} }
} }

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

@ -15,7 +15,7 @@ namespace DebuggerLibrary
{ {
NDebugger debugger; NDebugger debugger;
readonly SourcecodeSegment sourcecodeSegment; SourcecodeSegment sourcecodeSegment;
bool hadBeenSet = false; bool hadBeenSet = false;
bool enabled = true; bool enabled = true;
@ -39,8 +39,7 @@ namespace DebuggerLibrary
public bool Enabled { public bool Enabled {
get { get {
if (HadBeenSet) if (HadBeenSet) {
{
int active; int active;
corBreakpoint.IsActive(out active); corBreakpoint.IsActive(out active);
enabled = (active == 1); enabled = (active == 1);
@ -49,8 +48,7 @@ namespace DebuggerLibrary
} }
set { set {
enabled = value; enabled = value;
if (HadBeenSet) if (HadBeenSet) {
{
corBreakpoint.Activate(enabled?1:0); corBreakpoint.Activate(enabled?1:0);
} }
OnBreakpointStateChanged(); OnBreakpointStateChanged();
@ -74,43 +72,10 @@ namespace DebuggerLibrary
BreakpointHit(this, new BreakpointEventArgs(this)); BreakpointHit(this, new BreakpointEventArgs(this));
} }
internal Breakpoint(NDebugger debugger, SourcecodeSegment segment) internal Breakpoint(NDebugger debugger, SourcecodeSegment sourcecodeSegment, bool enabled)
{ {
this.debugger = debugger; this.debugger = debugger;
sourcecodeSegment = segment; this.sourcecodeSegment = sourcecodeSegment;
}
internal Breakpoint(NDebugger debugger, int line)
{
this.debugger = debugger;
sourcecodeSegment = new SourcecodeSegment();
sourcecodeSegment.StartLine = line;
}
internal Breakpoint(NDebugger debugger, string sourceFilename, int line)
{
this.debugger = debugger;
sourcecodeSegment = new SourcecodeSegment();
sourcecodeSegment.SourceFullFilename = sourceFilename;
sourcecodeSegment.StartLine = line;
}
internal Breakpoint(NDebugger debugger, string sourceFilename, int line, int column)
{
this.debugger = debugger;
sourcecodeSegment = new SourcecodeSegment();
sourcecodeSegment.SourceFullFilename = sourceFilename;
sourcecodeSegment.StartLine = line;
sourcecodeSegment.StartColumn = column;
}
internal Breakpoint(NDebugger debugger, string sourceFilename, int line, int column, bool enabled)
{
this.debugger = debugger;
sourcecodeSegment = new SourcecodeSegment();
sourcecodeSegment.SourceFullFilename = sourceFilename;
sourcecodeSegment.StartLine = line;
sourcecodeSegment.StartColumn = column;
this.enabled = enabled; this.enabled = enabled;
} }
@ -147,22 +112,17 @@ namespace DebuggerLibrary
return; return;
} }
SourcecodeSegment seg = sourcecodeSegment;
Module module = null; Module module = null;
ISymbolReader symReader = null; ISymbolReader symReader = null;
ISymbolDocument symDoc = null; ISymbolDocument symDoc = null;
// Try to get doc from seg.moduleFilename // Try to get doc from seg.moduleFilename
if (seg.ModuleFilename != null) if (sourcecodeSegment.ModuleFilename != null) {
{ try {
try module = debugger.GetModule(sourcecodeSegment.ModuleFilename);
{ symReader = debugger.GetModule(sourcecodeSegment.ModuleFilename).SymReader;
module = debugger.GetModule(seg.ModuleFilename); symDoc = symReader.GetDocument(sourcecodeSegment.SourceFullFilename,Guid.Empty,Guid.Empty,Guid.Empty);
symReader = debugger.GetModule(seg.ModuleFilename).SymReader; } catch {}
symDoc = symReader.GetDocument(seg.SourceFullFilename,Guid.Empty,Guid.Empty,Guid.Empty);
}
catch {}
} }
// search all modules // search all modules
@ -174,7 +134,7 @@ namespace DebuggerLibrary
continue; continue;
} }
symDoc = symReader.GetDocument(seg.SourceFullFilename,Guid.Empty,Guid.Empty,Guid.Empty); symDoc = symReader.GetDocument(sourcecodeSegment.SourceFullFilename,Guid.Empty,Guid.Empty,Guid.Empty);
if (symDoc != null) { if (symDoc != null) {
break; break;
@ -188,18 +148,18 @@ namespace DebuggerLibrary
} }
int validStartLine; int validStartLine;
validStartLine = symDoc.FindClosestLine(seg.StartLine); validStartLine = symDoc.FindClosestLine(sourcecodeSegment.StartLine);
if (validStartLine != seg.StartLine) { if (validStartLine != sourcecodeSegment.StartLine) {
seg.StartLine = validStartLine; sourcecodeSegment.StartLine = validStartLine;
seg.EndLine = validStartLine; sourcecodeSegment.EndLine = validStartLine;
seg.StartColumn = 0; sourcecodeSegment.StartColumn = 0;
seg.EndColumn = 0; sourcecodeSegment.EndColumn = 0;
} }
ISymbolMethod symMethod; ISymbolMethod symMethod;
symMethod = symReader.GetMethodFromDocumentPosition(symDoc, seg.StartLine, seg.StartColumn); symMethod = symReader.GetMethodFromDocumentPosition(symDoc, sourcecodeSegment.StartLine, sourcecodeSegment.StartColumn);
int corInstructionPtr = symMethod.GetOffset(symDoc, seg.StartLine, seg.StartColumn); int corInstructionPtr = symMethod.GetOffset(symDoc, sourcecodeSegment.StartLine, sourcecodeSegment.StartColumn);
ICorDebugFunction corFunction; ICorDebugFunction corFunction;
module.CorModule.GetFunctionFromToken((uint)symMethod.Token.GetToken(), out corFunction); module.CorModule.GetFunctionFromToken((uint)symMethod.Token.GetToken(), out corFunction);

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

@ -78,29 +78,9 @@ namespace DebuggerLibrary
return breakpoint; return breakpoint;
} }
public Breakpoint AddBreakpoint(SourcecodeSegment segment) public Breakpoint AddBreakpoint(SourcecodeSegment segment, bool breakpointEnabled)
{ {
return AddBreakpoint(new Breakpoint(this, segment)); return AddBreakpoint(new Breakpoint(this, segment, breakpointEnabled));
}
public Breakpoint AddBreakpoint(int line)
{
return AddBreakpoint(new Breakpoint(this, line));
}
public Breakpoint AddBreakpoint(string sourceFilename, int line)
{
return AddBreakpoint(new Breakpoint(this, sourceFilename, line));
}
public Breakpoint AddBreakpoint(string sourceFilename, int line, int column)
{
return AddBreakpoint(new Breakpoint(this, sourceFilename, line, column));
}
public Breakpoint AddBreakpoint(string sourceFilename, int line, int column, bool enabled)
{
return AddBreakpoint(new Breakpoint(this, sourceFilename, line, column, enabled));
} }
public void RemoveBreakpoint(Breakpoint breakpoint) public void RemoveBreakpoint(Breakpoint breakpoint)

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs

@ -286,7 +286,7 @@ namespace DebuggerLibrary
} }
// Add the breakpoint // Add the breakpoint
Breakpoint addedBreakpoint = AddBreakpoint(fileName, line, column); Breakpoint addedBreakpoint = AddBreakpoint(new SourcecodeSegment(fileName, line), true);
// Check if it wasn't forced to move to different line with breakpoint // Check if it wasn't forced to move to different line with breakpoint
foreach (Breakpoint breakpoint in Breakpoints) { foreach (Breakpoint breakpoint in Breakpoints) {

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

@ -234,7 +234,6 @@ namespace DebuggerLibrary
retVal.ModuleFilename = module.FullPath; retVal.ModuleFilename = module.FullPath;
retVal.SymbolDocument = Doc[i];
retVal.SourceFullFilename = Doc[i].URL; retVal.SourceFullFilename = Doc[i].URL;
retVal.StartLine = startLine[i]; retVal.StartLine = startLine[i];

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

@ -7,7 +7,8 @@ using System.Diagnostics.SymbolStore;
namespace DebuggerLibrary namespace DebuggerLibrary
{ {
public class SourcecodeSegment: RemotingObjectBase [Serializable]
public class SourcecodeSegment
{ {
string moduleFilename; string moduleFilename;
string sourceFullFilename; string sourceFullFilename;
@ -19,12 +20,36 @@ namespace DebuggerLibrary
int ilStart; int ilStart;
int ilEnd; int ilEnd;
int[] stepRanges; int[] stepRanges;
ISymbolDocument symUnmanagedDocument;
internal SourcecodeSegment() internal SourcecodeSegment()
{ {
} }
public SourcecodeSegment(string sourceFilename, int line)
{
this.sourceFullFilename = sourceFilename;
this.startLine = line;
this.endLine = line;
}
public SourcecodeSegment(string sourceFilename, int line, int startColumn, int endColumn)
{
this.sourceFullFilename = sourceFilename;
this.startLine = line;
this.endLine = line;
this.startColumn = startColumn;
this.endColumn = endColumn;
}
public SourcecodeSegment(string sourceFilename, int startLine, int endLine, int startColumn, int endColumn)
{
this.sourceFullFilename = sourceFilename;
this.startLine = startLine;
this.endLine = endLine;
this.startColumn = startColumn;
this.endColumn = endColumn;
}
public string ModuleFilename { public string ModuleFilename {
get { get {
@ -85,15 +110,6 @@ namespace DebuggerLibrary
endColumn = value; endColumn = value;
} }
} }
public ISymbolDocument SymbolDocument {
get {
return symUnmanagedDocument;
}
set {
symUnmanagedDocument = value;
}
}
public int[] StepRanges { public int[] StepRanges {
get { get {

Loading…
Cancel
Save