@ -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,9 +81,14 @@ 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 S erviceInitialized & & debuggedProcess ! = null ;
}
}
}
}
@ -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 )