Browse Source

Merge remote branch 'eusebiu/master'

pull/15/head
Eusebiu Marcu 15 years ago
parent
commit
8d447b5b69
  1. 11
      src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs
  2. 9
      src/AddIns/Debugger/Debugger.Core/Breakpoint.cs
  3. 36
      src/AddIns/Debugger/Debugger.Core/Process.cs
  4. 12
      src/Main/Base/Project/ICSharpCode.SharpDevelop.addin
  5. 12
      src/Main/Base/Project/Src/Commands/DebugCommands.cs
  6. 5
      src/Main/Base/Project/Src/Services/Debugger/DefaultDebugger.cs
  7. 7
      src/Main/Base/Project/Src/Services/Debugger/IDebugger.cs

11
src/AddIns/Debugger/Debugger.AddIn/Service/WindowsDebugger.cs

@ -73,6 +73,12 @@ namespace ICSharpCode.SharpDevelop.Services @@ -73,6 +73,12 @@ namespace ICSharpCode.SharpDevelop.Services
}
}
/// <inheritdoc/>
public bool BreakAtBegining {
get;
set;
}
protected virtual void OnProcessSelected(ProcessEventArgs e)
{
if (ProcessSelected != null) {
@ -652,7 +658,12 @@ namespace ICSharpCode.SharpDevelop.Services @@ -652,7 +658,12 @@ namespace ICSharpCode.SharpDevelop.Services
debuggedProcess.Paused += debuggedProcess_DebuggingPaused;
debuggedProcess.ExceptionThrown += debuggedProcess_ExceptionThrown;
debuggedProcess.Resumed += debuggedProcess_DebuggingResumed;
debuggedProcess.BreakAtBegining = BreakAtBegining;
}
// reset
BreakAtBegining = false;
JumpToCurrentLine();
OnProcessSelected(new ProcessEventArgs(process));
}

9
src/AddIns/Debugger/Debugger.Core/Breakpoint.cs

@ -88,6 +88,12 @@ namespace Debugger @@ -88,6 +88,12 @@ namespace Debugger
}
}
public Breakpoint(NDebugger debugger, ICorDebugFunctionBreakpoint corBreakpoint)
{
this.debugger = debugger;
this.corBreakpoints.Add(corBreakpoint);
}
public Breakpoint(NDebugger debugger, string fileName, byte[] checkSum, int line, int column, bool enabled)
{
this.debugger = debugger;
@ -134,6 +140,9 @@ namespace Debugger @@ -134,6 +140,9 @@ namespace Debugger
internal bool SetBreakpoint(Module module)
{
if (this.fileName == null)
return false;
SourcecodeSegment segment = SourcecodeSegment.Resolve(module, FileName, CheckSum, Line, Column);
if (segment == null) return false;

36
src/AddIns/Debugger/Debugger.Core/Process.cs

@ -5,8 +5,8 @@ using System; @@ -5,8 +5,8 @@ using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Debugger.Interop;
using Debugger.Interop.CorDebug;
using Debugger.Interop.CorSym;
using ICSharpCode.NRefactory.Ast;
using ICSharpCode.NRefactory.Visitors;
@ -89,6 +89,11 @@ namespace Debugger @@ -89,6 +89,11 @@ namespace Debugger
}
}
public bool BreakAtBegining {
get;
set;
}
public AppDomainCollection AppDomains {
get { return appDomains; }
}
@ -113,6 +118,7 @@ namespace Debugger @@ -113,6 +118,7 @@ namespace Debugger
activeEvals = new EvalCollection(debugger);
modules = new ModuleCollection(debugger);
modules.Added += OnModulesAdded;
threads = new ThreadCollection(debugger);
appDomains = new AppDomainCollection(debugger);
}
@ -266,7 +272,6 @@ namespace Debugger @@ -266,7 +272,6 @@ namespace Debugger
}
}
#endregion
#region PauseSession & DebugeeState
@ -627,5 +632,32 @@ namespace Debugger @@ -627,5 +632,32 @@ namespace Debugger
debugger.MTA2STA.PerformAllCalls();
}
}
#region Break at begining
private void OnModulesAdded(object sender, CollectionItemEventArgs<Module> e)
{
if (BreakAtBegining) {
if (e.Item.SymReader == null) return; // No symbols
// create a BP at entry point
uint entryPoint = e.Item.SymReader.GetUserEntryPoint();
if (entryPoint == 0) return; // no EP
var mainFunction = e.Item.CorModule.GetFunctionFromToken(entryPoint);
var corBreakpoint = mainFunction.CreateBreakpoint();
corBreakpoint.Activate(1);
// create a SD BP
var breakpoint = new Breakpoint(this.debugger, corBreakpoint);
this.debugger.Breakpoints.Add(breakpoint);
breakpoint.Hit += delegate {
if (breakpoint != null)
breakpoint.Remove();
breakpoint = null;
};
BreakAtBegining = false;
}
}
#endregion
}
}

12
src/Main/Base/Project/ICSharpCode.SharpDevelop.addin

@ -928,9 +928,9 @@ @@ -928,9 +928,9 @@
</ComplexCondition>
</Condition>
<Condition name="IsProcessRunning" isdebugging = "True">
<Condition name="DebuggerSupports" debuggersupports = "Stepping">
<Condition name="IsProcessRunning" isprocessrunning = "False" action = "Disable">
<Condition name = "SolutionOpen" action = "Disable">
<Condition name="DebuggerSupports" debuggersupports = "Start">
<ToolbarItem id = "SteppingSeparator" type = "Separator" />
<ToolbarItem id = "Step over"
icon = "Icons.16x16.Debug.StepOver"
@ -940,6 +940,7 @@ @@ -940,6 +940,7 @@
icon = "Icons.16x16.Debug.StepInto"
tooltip = "${res:XML.MainMenu.DebugMenu.StepInto.Description}"
class = "ICSharpCode.SharpDevelop.Project.Commands.StepIntoDebuggingCommand"/>
<Condition name="IsProcessRunning" isdebugging = "True">
<ToolbarItem id = "Step out"
icon = "Icons.16x16.Debug.StepOut"
tooltip = "${res:XML.MainMenu.DebugMenu.StepOut.Description}"
@ -947,6 +948,7 @@ @@ -947,6 +948,7 @@
</Condition>
</Condition>
</Condition>
</Condition>
<ToolbarItem id = "ChooseConfigurationSeparator" type = "Separator"/>
@ -1548,7 +1550,8 @@ @@ -1548,7 +1550,8 @@
</Condition>
<Condition name="DebuggerSupports" debuggersupports = "Stepping">
<Condition name="IsProcessRunning" isprocessrunning = "False" isdebugging = "True" action = "Disable">
<Condition name = "SolutionOpen" action = "Disable">
<Condition name="DebuggerSupports" debuggersupports = "Start">
<MenuItem id = "BeforeSteppingSeparator" type = "Separator" />
<MenuItem id = "Step over"
label = "${res:XML.MainMenu.DebugMenu.StepOver}"
@ -1560,6 +1563,7 @@ @@ -1560,6 +1563,7 @@
icon = "Icons.16x16.Debug.StepInto"
shortcut = "F11"
class = "ICSharpCode.SharpDevelop.Project.Commands.StepIntoDebuggingCommand"/>
<Condition name="IsProcessRunning" isdebugging = "True">
<MenuItem id = "Step out"
label = "${res:XML.MainMenu.DebugMenu.StepOut}"
icon = "Icons.16x16.Debug.StepOut"
@ -1567,6 +1571,8 @@ @@ -1567,6 +1571,8 @@
class = "ICSharpCode.SharpDevelop.Project.Commands.StepOutDebuggingCommand"/>
</Condition>
</Condition>
</Condition>
</Condition>
<MenuItem id = "ToggleBreakpointSeparator" type = "Separator" />
<ComplexCondition action="Disable">

12
src/Main/Base/Project/Src/Commands/DebugCommands.cs

@ -83,16 +83,26 @@ namespace ICSharpCode.SharpDevelop.Project.Commands @@ -83,16 +83,26 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
public override void Run()
{
LoggingService.Info("Debugger Command: StepOver");
if (!DebuggerService.CurrentDebugger.IsDebugging) {
DebuggerService.CurrentDebugger.BreakAtBegining = true;
new Execute().Run();
} else {
DebuggerService.CurrentDebugger.StepOver();
}
}
}
public class StepIntoDebuggingCommand : AbstractMenuCommand
{
public override void Run()
{
LoggingService.Info("Debugger Command: StepInto");
DebuggerService.CurrentDebugger.StepInto();
if (!DebuggerService.CurrentDebugger.IsDebugging) {
DebuggerService.CurrentDebugger.BreakAtBegining = true;
new Execute().Run();
} else {
DebuggerService.CurrentDebugger.StepOver();
}
}
}

5
src/Main/Base/Project/Src/Services/Debugger/DefaultDebugger.cs

@ -25,6 +25,11 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -25,6 +25,11 @@ namespace ICSharpCode.SharpDevelop.Debugging
}
}
/// <inheritdoc/>
public bool BreakAtBegining {
get; set;
}
public bool CanDebug(IProject project)
{
return true;

7
src/Main/Base/Project/Src/Services/Debugger/IDebugger.cs

@ -25,6 +25,13 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -25,6 +25,13 @@ namespace ICSharpCode.SharpDevelop.Debugging
get;
}
/// <summary>
/// Gets or sets whether the debugger should break at the first line of execution.
/// </summary>
bool BreakAtBegining {
get; set;
}
bool CanDebug(IProject project);
/// <summary>

Loading…
Cancel
Save