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ý 20 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 @@ -298,7 +298,7 @@ namespace ICSharpCode.SharpDevelop.Services
{
debugger.ClearBreakpoints();
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;
}
}

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

@ -15,7 +15,7 @@ namespace DebuggerLibrary @@ -15,7 +15,7 @@ namespace DebuggerLibrary
{
NDebugger debugger;
readonly SourcecodeSegment sourcecodeSegment;
SourcecodeSegment sourcecodeSegment;
bool hadBeenSet = false;
bool enabled = true;
@ -39,8 +39,7 @@ namespace DebuggerLibrary @@ -39,8 +39,7 @@ namespace DebuggerLibrary
public bool Enabled {
get {
if (HadBeenSet)
{
if (HadBeenSet) {
int active;
corBreakpoint.IsActive(out active);
enabled = (active == 1);
@ -49,8 +48,7 @@ namespace DebuggerLibrary @@ -49,8 +48,7 @@ namespace DebuggerLibrary
}
set {
enabled = value;
if (HadBeenSet)
{
if (HadBeenSet) {
corBreakpoint.Activate(enabled?1:0);
}
OnBreakpointStateChanged();
@ -74,43 +72,10 @@ namespace DebuggerLibrary @@ -74,43 +72,10 @@ namespace DebuggerLibrary
BreakpointHit(this, new BreakpointEventArgs(this));
}
internal Breakpoint(NDebugger debugger, SourcecodeSegment segment)
internal Breakpoint(NDebugger debugger, SourcecodeSegment sourcecodeSegment, bool enabled)
{
this.debugger = debugger;
sourcecodeSegment = segment;
}
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.sourcecodeSegment = sourcecodeSegment;
this.enabled = enabled;
}
@ -147,22 +112,17 @@ namespace DebuggerLibrary @@ -147,22 +112,17 @@ namespace DebuggerLibrary
return;
}
SourcecodeSegment seg = sourcecodeSegment;
Module module = null;
ISymbolReader symReader = null;
ISymbolDocument symDoc = null;
// Try to get doc from seg.moduleFilename
if (seg.ModuleFilename != null)
{
try
{
module = debugger.GetModule(seg.ModuleFilename);
symReader = debugger.GetModule(seg.ModuleFilename).SymReader;
symDoc = symReader.GetDocument(seg.SourceFullFilename,Guid.Empty,Guid.Empty,Guid.Empty);
}
catch {}
if (sourcecodeSegment.ModuleFilename != null) {
try {
module = debugger.GetModule(sourcecodeSegment.ModuleFilename);
symReader = debugger.GetModule(sourcecodeSegment.ModuleFilename).SymReader;
symDoc = symReader.GetDocument(sourcecodeSegment.SourceFullFilename,Guid.Empty,Guid.Empty,Guid.Empty);
} catch {}
}
// search all modules
@ -174,7 +134,7 @@ namespace DebuggerLibrary @@ -174,7 +134,7 @@ namespace DebuggerLibrary
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) {
break;
@ -188,18 +148,18 @@ namespace DebuggerLibrary @@ -188,18 +148,18 @@ namespace DebuggerLibrary
}
int validStartLine;
validStartLine = symDoc.FindClosestLine(seg.StartLine);
if (validStartLine != seg.StartLine) {
seg.StartLine = validStartLine;
seg.EndLine = validStartLine;
seg.StartColumn = 0;
seg.EndColumn = 0;
validStartLine = symDoc.FindClosestLine(sourcecodeSegment.StartLine);
if (validStartLine != sourcecodeSegment.StartLine) {
sourcecodeSegment.StartLine = validStartLine;
sourcecodeSegment.EndLine = validStartLine;
sourcecodeSegment.StartColumn = 0;
sourcecodeSegment.EndColumn = 0;
}
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;
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 @@ -78,29 +78,9 @@ namespace DebuggerLibrary
return breakpoint;
}
public Breakpoint AddBreakpoint(SourcecodeSegment segment)
public Breakpoint AddBreakpoint(SourcecodeSegment segment, bool breakpointEnabled)
{
return AddBreakpoint(new Breakpoint(this, segment));
}
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));
return AddBreakpoint(new Breakpoint(this, segment, breakpointEnabled));
}
public void RemoveBreakpoint(Breakpoint breakpoint)

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

@ -286,7 +286,7 @@ namespace DebuggerLibrary @@ -286,7 +286,7 @@ namespace DebuggerLibrary
}
// 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
foreach (Breakpoint breakpoint in Breakpoints) {

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

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

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

@ -7,7 +7,8 @@ using System.Diagnostics.SymbolStore; @@ -7,7 +7,8 @@ using System.Diagnostics.SymbolStore;
namespace DebuggerLibrary
{
public class SourcecodeSegment: RemotingObjectBase
[Serializable]
public class SourcecodeSegment
{
string moduleFilename;
string sourceFullFilename;
@ -19,12 +20,36 @@ namespace DebuggerLibrary @@ -19,12 +20,36 @@ namespace DebuggerLibrary
int ilStart;
int ilEnd;
int[] stepRanges;
ISymbolDocument symUnmanagedDocument;
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 {
get {
@ -85,15 +110,6 @@ namespace DebuggerLibrary @@ -85,15 +110,6 @@ namespace DebuggerLibrary
endColumn = value;
}
}
public ISymbolDocument SymbolDocument {
get {
return symUnmanagedDocument;
}
set {
symUnmanagedDocument = value;
}
}
public int[] StepRanges {
get {

Loading…
Cancel
Save