Browse Source

Added a few error messages for double-clicks:

Fixed SD2-1088: Debugger throws exception clicking run command two times in a row. 
Fixed SD2-1089: Debugger throws exception trying to break a project two times in a row. 
Fixed SD2-1091: Debugger throws exception clicking stop debug command two times ina row. 

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1800 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 19 years ago
parent
commit
89927bd77b
  1. 53
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs

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

@ -39,8 +39,6 @@ namespace ICSharpCode.SharpDevelop.Services
Properties properties; Properties properties;
bool serviceInitialized = false;
Debugger.Process debuggedProcess; Debugger.Process debuggedProcess;
public event EventHandler<ProcessEventArgs> ProcessSelected; public event EventHandler<ProcessEventArgs> ProcessSelected;
@ -72,7 +70,7 @@ namespace ICSharpCode.SharpDevelop.Services
public bool ServiceInitialized { public bool ServiceInitialized {
get { get {
return serviceInitialized; return debugger != null;
} }
} }
@ -83,15 +81,20 @@ namespace ICSharpCode.SharpDevelop.Services
#region IDebugger Members #region IDebugger Members
string errorDebugging = "Can not preform action because some process is debugged.";
string errorNotDebugging = "Can not preform action because no process is debugged.";
string errorProcessRunning = "Can not preform action because process is running.";
string errorProcessPaused = "Can not preform action because process is paused.";
public bool IsDebugging { public bool IsDebugging {
get { get {
return serviceInitialized && debuggedProcess != null; return ServiceInitialized && debuggedProcess != null;
} }
} }
public bool IsProcessRunning { public bool IsProcessRunning {
get { get {
return IsDebugging && debuggedProcess.IsRunning; return IsDebugging && debuggedProcess.IsRunning;
} }
} }
@ -102,7 +105,11 @@ namespace ICSharpCode.SharpDevelop.Services
public void Start(ProcessStartInfo processStartInfo) public void Start(ProcessStartInfo processStartInfo)
{ {
if (!serviceInitialized) { if (IsDebugging) {
MessageService.ShowMessage(errorDebugging);
return;
}
if (!ServiceInitialized) {
InitializeService(); InitializeService();
} }
string version = debugger.GetProgramVersion(processStartInfo.FileName); string version = debugger.GetProgramVersion(processStartInfo.FileName);
@ -125,6 +132,10 @@ namespace ICSharpCode.SharpDevelop.Services
public void Stop() public void Stop()
{ {
if (!IsDebugging) {
MessageService.ShowMessage(errorNotDebugging);
return;
}
debuggedProcess.Terminate(); debuggedProcess.Terminate();
} }
@ -132,11 +143,27 @@ namespace ICSharpCode.SharpDevelop.Services
public void Break() public void Break()
{ {
if (!IsDebugging) {
MessageService.ShowMessage(errorNotDebugging);
return;
}
if (!IsProcessRunning) {
MessageService.ShowMessage(errorProcessPaused);
return;
}
debuggedProcess.Break(); debuggedProcess.Break();
} }
public void Continue() public void Continue()
{ {
if (!IsDebugging) {
MessageService.ShowMessage(errorNotDebugging);
return;
}
if (IsProcessRunning) {
MessageService.ShowMessage(errorProcessRunning);
return;
}
debuggedProcess.Continue(); debuggedProcess.Continue();
} }
@ -144,6 +171,10 @@ namespace ICSharpCode.SharpDevelop.Services
public void StepInto() public void StepInto()
{ {
if (!IsDebugging) {
MessageService.ShowMessage(errorNotDebugging);
return;
}
if (debuggedProcess.SelectedFunction == null || debuggedProcess.IsRunning) { if (debuggedProcess.SelectedFunction == null || debuggedProcess.IsRunning) {
MessageService.ShowMessage("${res:MainWindow.Windows.Debug.Threads.CannotStepNoActiveFunction}", "${res:XML.MainMenu.DebugMenu.StepInto}"); MessageService.ShowMessage("${res:MainWindow.Windows.Debug.Threads.CannotStepNoActiveFunction}", "${res:XML.MainMenu.DebugMenu.StepInto}");
} else { } else {
@ -153,6 +184,10 @@ namespace ICSharpCode.SharpDevelop.Services
public void StepOver() public void StepOver()
{ {
if (!IsDebugging) {
MessageService.ShowMessage(errorNotDebugging);
return;
}
if (debuggedProcess.SelectedFunction == null || debuggedProcess.IsRunning) { if (debuggedProcess.SelectedFunction == null || debuggedProcess.IsRunning) {
MessageService.ShowMessage("${res:MainWindow.Windows.Debug.Threads.CannotStepNoActiveFunction}", "${res:XML.MainMenu.DebugMenu.StepOver.Description}"); MessageService.ShowMessage("${res:MainWindow.Windows.Debug.Threads.CannotStepNoActiveFunction}", "${res:XML.MainMenu.DebugMenu.StepOver.Description}");
} else { } else {
@ -162,6 +197,10 @@ namespace ICSharpCode.SharpDevelop.Services
public void StepOut() public void StepOut()
{ {
if (!IsDebugging) {
MessageService.ShowMessage(errorNotDebugging);
return;
}
if (debuggedProcess.SelectedFunction == null || debuggedProcess.IsRunning) { if (debuggedProcess.SelectedFunction == null || debuggedProcess.IsRunning) {
MessageService.ShowMessage("${res:MainWindow.Windows.Debug.Threads.CannotStepNoActiveFunction}", "${res:XML.MainMenu.DebugMenu.StepOut}"); MessageService.ShowMessage("${res:MainWindow.Windows.Debug.Threads.CannotStepNoActiveFunction}", "${res:XML.MainMenu.DebugMenu.StepOut}");
} else { } else {
@ -284,8 +323,6 @@ namespace ICSharpCode.SharpDevelop.Services
if (Initialize != null) { if (Initialize != null) {
Initialize(this, null); Initialize(this, null);
} }
serviceInitialized = true;
} }
void AddBreakpoint(BreakpointBookmark bookmark) void AddBreakpoint(BreakpointBookmark bookmark)

Loading…
Cancel
Save