@ -50,22 +50,9 @@ namespace ICSharpCode.SharpDevelop.Services
internal IDebuggerDecompilerService debuggerDecompilerService ;
internal IDebuggerDecompilerService debuggerDecompilerService ;
//DynamicTreeDebuggerRow currentTooltipRow;
public NDebugger DebuggerCore { get { return debugger ; } }
//Expression currentTooltipExpression;
public event EventHandler < ProcessEventArgs > ProcessSelected ;
public Process DebuggedProcess { get { return debuggedProcess ; } }
public NDebugger DebuggerCore {
get {
return debugger ;
}
}
public Process DebuggedProcess {
get {
return debuggedProcess ;
}
}
public static Process CurrentProcess {
public static Process CurrentProcess {
get {
get {
@ -78,19 +65,26 @@ namespace ICSharpCode.SharpDevelop.Services
}
}
}
}
/// <inheritdoc/>
public static event EventHandler < DebuggerEventArgs > RefreshingPads ;
public bool BreakAtBeginning {
get ;
public static void RefreshPads ( )
set ;
{
RefreshPads ( new DebuggerEventArgs ( CurrentProcess ) ) ;
}
}
protected virtual void OnProcessSelected ( Process EventArgs e )
public static void RefreshPads ( Debugger EventArgs e )
{
{
if ( ProcessSelected ! = null ) {
if ( RefreshingPads ! = null ) {
ProcessSelected ( this , e ) ;
RefreshingPads ( null , e ) ;
}
}
}
}
/// <inheritdoc/>
public bool BreakAtBeginning {
get ;
set ;
}
public bool ServiceInitialized {
public bool ServiceInitialized {
get {
get {
return debugger ! = null ;
return debugger ! = null ;
@ -159,13 +153,13 @@ namespace ICSharpCode.SharpDevelop.Services
if ( DebugStarting ! = null )
if ( DebugStarting ! = null )
DebugStarting ( this , EventArgs . Empty ) ;
DebugStarting ( this , EventArgs . Empty ) ;
UpdateBreakpointLines ( ) ;
try {
try {
// set the JIT flag for evaluating optimized code
// set the JIT flag for evaluating optimized code
Process . DebugMode = DebugModeFlag . Debug ;
Process . DebugMode = DebugModeFlag . Debug ;
Process process = debugger . Start ( processStartInfo . FileName ,
this . debuggedProcess = debugger . Start ( processStartInfo . FileName , processStartInfo . WorkingDirectory , processStartInfo . Arguments , this . BreakAtBeginning ) ;
processStartInfo . WorkingDirectory ,
debugger_ProcessStarted ( this . debuggedProcess ) ;
processStartInfo . Arguments ) ;
SelectProcess ( process ) ;
} catch ( System . Exception e ) {
} catch ( System . Exception e ) {
// COMException: The request is not supported. (Exception from HRESULT: 0x80070032)
// COMException: The request is not supported. (Exception from HRESULT: 0x80070032)
// COMException: The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail. (Exception from HRESULT: 0x800736B1)
// COMException: The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log for more detail. (Exception from HRESULT: 0x800736B1)
@ -176,7 +170,6 @@ namespace ICSharpCode.SharpDevelop.Services
if ( e is COMException | | e is BadImageFormatException | | e is UnauthorizedAccessException ) {
if ( e is COMException | | e is BadImageFormatException | | e is UnauthorizedAccessException ) {
string msg = StringParser . Parse ( "${res:XML.MainMenu.DebugMenu.Error.CannotStartProcess}" ) ;
string msg = StringParser . Parse ( "${res:XML.MainMenu.DebugMenu.Error.CannotStartProcess}" ) ;
msg + = " " + e . Message ;
msg + = " " + e . Message ;
// TODO: Remove
if ( e is COMException & & ( ( uint ) ( ( COMException ) e ) . ErrorCode = = 0x80070032 ) ) {
if ( e is COMException & & ( ( uint ) ( ( COMException ) e ) . ErrorCode = = 0x80070032 ) ) {
msg + = Environment . NewLine + Environment . NewLine ;
msg + = Environment . NewLine + Environment . NewLine ;
msg + = "64-bit debugging is not supported. Please set Project -> Project Options... -> Compiling -> Target CPU to 32bit." ;
msg + = "64-bit debugging is not supported. Please set Project -> Project Options... -> Compiling -> Target CPU to 32bit." ;
@ -221,14 +214,15 @@ namespace ICSharpCode.SharpDevelop.Services
if ( DebugStarting ! = null )
if ( DebugStarting ! = null )
DebugStarting ( this , EventArgs . Empty ) ;
DebugStarting ( this , EventArgs . Empty ) ;
UpdateBreakpointLines ( ) ;
try {
try {
// set the JIT flag for evaluating optimized code
// set the JIT flag for evaluating optimized code
Process . DebugMode = DebugModeFlag . Debug ;
Process . DebugMode = DebugModeFlag . Debug ;
Process process = debugger . Attach ( existingProcess ) ;
this . debuggedProcess = debugger . Attach ( existingProcess ) ;
debugger_ProcessStarted ( this . debuggedProcess ) ;
attached = true ;
attached = true ;
SelectProcess ( process ) ;
this . debuggedProcess . ModuleLoaded + = process_Modules_Added ;
process . Modules . Added + = process_Modules_Added ;
} catch ( System . Exception e ) {
} catch ( System . Exception e ) {
// CORDBG_E_DEBUGGER_ALREADY_ATTACHED
// CORDBG_E_DEBUGGER_ALREADY_ATTACHED
if ( e is COMException | | e is UnauthorizedAccessException ) {
if ( e is COMException | | e is UnauthorizedAccessException ) {
@ -547,9 +541,6 @@ namespace ICSharpCode.SharpDevelop.Services
// init NDebugger
// init NDebugger
debugger = new NDebugger ( ) ;
debugger = new NDebugger ( ) ;
debugger . Options = DebuggingOptions . Instance ;
debugger . Options = DebuggingOptions . Instance ;
debugger . DebuggerTraceMessage + = debugger_TraceMessage ;
debugger . Processes . Added + = debugger_ProcessStarted ;
debugger . Processes . Removed + = debugger_ProcessExited ;
DebuggerService . BreakPointAdded + = delegate ( object sender , BreakpointBookmarkEventArgs e ) {
DebuggerService . BreakPointAdded + = delegate ( object sender , BreakpointBookmarkEventArgs e ) {
AddBreakpoint ( e . BreakpointBookmark ) ;
AddBreakpoint ( e . BreakpointBookmark ) ;
@ -559,18 +550,34 @@ namespace ICSharpCode.SharpDevelop.Services
AddBreakpoint ( b ) ;
AddBreakpoint ( b ) ;
}
}
BookmarkManager . Removed + = ( sender , e ) = > {
BreakpointBookmark bm = e . Bookmark as BreakpointBookmark ;
if ( bm ! = null ) {
Breakpoint bp = bm . InternalBreakpointObject as Breakpoint ;
bp . IsEnabled = false ;
}
} ;
if ( Initialize ! = null ) {
if ( Initialize ! = null ) {
Initialize ( this , null ) ;
Initialize ( this , null ) ;
}
}
}
}
bool Compare ( byte [ ] a , byte [ ] b )
void UpdateBreakpointLines ( )
{
{
if ( a . Length ! = b . Length ) return false ;
foreach ( BreakpointBookmark bookmark in BookmarkManager . Bookmarks . OfType < BreakpointBookmark > ( ) ) {
for ( int i = 0 ; i < a . Length ; i + + ) {
Breakpoint breakpoint = bookmark . InternalBreakpointObject as Breakpoint ;
if ( a [ i ] ! = b [ i ] ) return false ;
breakpoint . Line = bookmark . LineNumber ;
breakpoint . Column = bookmark . ColumnNumber ;
}
}
void UpdateBreakpointIcons ( )
{
foreach ( BreakpointBookmark bookmark in BookmarkManager . Bookmarks . OfType < BreakpointBookmark > ( ) ) {
Breakpoint breakpoint = bookmark . InternalBreakpointObject as Breakpoint ;
bookmark . IsHealthy = ( debuggedProcess = = null ) | | breakpoint . IsSet ;
}
}
return true ;
}
}
void AddBreakpoint ( BreakpointBookmark bookmark )
void AddBreakpoint ( BreakpointBookmark bookmark )
@ -598,23 +605,13 @@ namespace ICSharpCode.SharpDevelop.Services
int [ ] ilRanges ;
int [ ] ilRanges ;
int methodToken ;
int methodToken ;
if ( debuggerDecompilerService . GetILAndTokenByLineNumber ( token , dbb . LineNumber , out ilRanges , out methodToken ) ) {
if ( debuggerDecompilerService . GetILAndTokenByLineNumber ( token , dbb . LineNumber , out ilRanges , out methodToken ) ) {
// create BP
debugger . AddILBreakpoint ( memberReference . FullName , dbb . LineNumber , memberReference . MetadataToken . ToInt32 ( ) , methodToken , ilRanges [ 0 ] , dbb . IsEnabled ) ;
breakpoint = new ILBreakpoint (
debugger ,
memberReference . FullName ,
dbb . LineNumber ,
memberReference . MetadataToken . ToInt32 ( ) ,
methodToken ,
ilRanges [ 0 ] ,
dbb . IsEnabled ) ;
debugger . Breakpoints . Add ( breakpoint ) ;
}
}
} catch ( System . Exception ex ) {
} catch ( System . Exception ex ) {
LoggingService . Error ( "Error on DecompiledBreakpointBookmark: " + ex . Message ) ;
LoggingService . Error ( "Error on DecompiledBreakpointBookmark: " + ex . Message ) ;
}
}
} else {
} else {
breakpoint = debugger . Breakpoints . Add ( bookmark . FileName , null , bookmark . LineNumber , 0 , bookmark . IsEnabled ) ;
breakpoint = debugger . AddBreakpoint ( bookmark . FileName , bookmark . LineNumber , 0 , bookmark . IsEnabled ) ;
}
}
if ( breakpoint = = null ) {
if ( breakpoint = = null ) {
@ -622,93 +619,9 @@ namespace ICSharpCode.SharpDevelop.Services
return ;
return ;
}
}
MethodInvoker setBookmarkColor = delegate {
bookmark . InternalBreakpointObject = breakpoint ;
if ( debugger . Processes . Count = = 0 ) {
bookmark . IsHealthy = ( debuggedProcess = = null ) | | breakpoint . IsSet ;
bookmark . IsHealthy = true ;
bookmark . IsEnabledChanged + = delegate { breakpoint . IsEnabled = bookmark . IsEnabled ; } ;
bookmark . Tooltip = null ;
} else if ( ! breakpoint . IsSet ) {
bookmark . IsHealthy = false ;
bookmark . Tooltip = "Breakpoint was not found in any loaded modules" ;
} else if ( breakpoint . OriginalLocation = = null | | breakpoint . OriginalLocation . CheckSum = = null ) {
bookmark . IsHealthy = true ;
bookmark . Tooltip = null ;
} else {
if ( ! File . Exists ( bookmark . FileName ) )
return ;
byte [ ] fileMD5 ;
IEditable file = FileService . GetOpenFile ( bookmark . FileName ) as IEditable ;
if ( file ! = null ) {
byte [ ] fileContent = Encoding . UTF8 . GetBytesWithPreamble ( file . Text ) ;
fileMD5 = new MD5CryptoServiceProvider ( ) . ComputeHash ( fileContent ) ;
} else {
fileMD5 = new MD5CryptoServiceProvider ( ) . ComputeHash ( File . ReadAllBytes ( bookmark . FileName ) ) ;
}
if ( Compare ( fileMD5 , breakpoint . OriginalLocation . CheckSum ) ) {
bookmark . IsHealthy = true ;
bookmark . Tooltip = null ;
} else {
bookmark . IsHealthy = false ;
bookmark . Tooltip = "Check sum or file does not match to the original" ;
}
}
} ;
// event handlers on bookmark and breakpoint don't need deregistration
bookmark . IsEnabledChanged + = delegate {
breakpoint . Enabled = bookmark . IsEnabled ;
} ;
breakpoint . Set + = delegate { setBookmarkColor ( ) ; } ;
setBookmarkColor ( ) ;
EventHandler < CollectionItemEventArgs < Process > > bp_debugger_ProcessStarted = ( sender , e ) = > {
setBookmarkColor ( ) ;
// User can change line number by inserting or deleting lines
breakpoint . Line = bookmark . LineNumber ;
} ;
EventHandler < CollectionItemEventArgs < Process > > bp_debugger_ProcessExited = ( sender , e ) = > {
setBookmarkColor ( ) ;
} ;
EventHandler < BreakpointEventArgs > bp_debugger_BreakpointHit =
new EventHandler < BreakpointEventArgs > (
delegate ( object sender , BreakpointEventArgs e )
{
LoggingService . Debug ( bookmark . Action + " " + bookmark . ScriptLanguage + " " + bookmark . Condition ) ;
switch ( bookmark . Action ) {
case BreakpointAction . Break :
break ;
case BreakpointAction . Condition :
if ( Evaluate ( bookmark . Condition , bookmark . ScriptLanguage ) )
DebuggerService . PrintDebugMessage ( string . Format ( StringParser . Parse ( "${res:MainWindow.Windows.Debug.Conditional.Breakpoints.BreakpointHitAtBecause}" ) + "\n" , bookmark . LineNumber , bookmark . FileName , bookmark . Condition ) ) ;
else
this . debuggedProcess . AsyncContinue ( ) ;
break ;
case BreakpointAction . Trace :
DebuggerService . PrintDebugMessage ( string . Format ( StringParser . Parse ( "${res:MainWindow.Windows.Debug.Conditional.Breakpoints.BreakpointHitAt}" ) + "\n" , bookmark . LineNumber , bookmark . FileName ) ) ;
break ;
}
} ) ;
BookmarkEventHandler bp_bookmarkManager_Removed = null ;
bp_bookmarkManager_Removed = ( sender , e ) = > {
if ( bookmark = = e . Bookmark ) {
debugger . Breakpoints . Remove ( breakpoint ) ;
// unregister the events
debugger . Processes . Added - = bp_debugger_ProcessStarted ;
debugger . Processes . Removed - = bp_debugger_ProcessExited ;
breakpoint . Hit - = bp_debugger_BreakpointHit ;
BookmarkManager . Removed - = bp_bookmarkManager_Removed ;
}
} ;
// register the events
debugger . Processes . Added + = bp_debugger_ProcessStarted ;
debugger . Processes . Removed + = bp_debugger_ProcessExited ;
breakpoint . Hit + = bp_debugger_BreakpointHit ;
BookmarkManager . Removed + = bp_bookmarkManager_Removed ;
}
}
bool Evaluate ( string code , string language )
bool Evaluate ( string code , string language )
@ -734,113 +647,87 @@ namespace ICSharpCode.SharpDevelop.Services
DebuggerService . PrintDebugMessage ( e . Message ) ;
DebuggerService . PrintDebugMessage ( e . Message ) ;
}
}
void debugger_TraceMessage ( object sender , MessageEventArgs e )
void debugger_ProcessStarted ( Process process )
{
LoggingService . Debug ( "Debugger: " + e . Message ) ;
}
void debugger_ProcessStarted ( object sender , CollectionItemEventArgs < Process > e )
{
{
if ( debugger . Processes . Count = = 1 ) {
if ( DebugStarted ! = null ) {
if ( DebugStarted ! = null ) {
DebugStarted ( this , EventArgs . Empty ) ;
DebugStarted ( this , EventArgs . Empty ) ;
}
}
e . Item . LogMessage + = LogMessage ;
}
void debugger_ProcessExited ( object sender , CollectionItemEventArgs < Process > e )
{
if ( debugger . Processes . Count = = 0 ) {
if ( DebugStopped ! = null ) {
DebugStopped ( this , e ) ;
}
SelectProcess ( null ) ;
} else {
SelectProcess ( debugger . Processes [ 0 ] ) ;
}
}
}
public void SelectProcess ( Process process )
{
if ( debuggedProcess ! = null ) {
debuggedProcess . Paused - = debuggedProcess_DebuggingPaused ;
debuggedProcess . ExceptionThrown - = debuggedProcess_ExceptionThrown ;
debuggedProcess . Resumed - = debuggedProcess_DebuggingResumed ;
debuggedProcess . ModulesAdded - = debuggedProcess_ModulesAdded ;
}
debuggedProcess = process ;
if ( debuggedProcess ! = null ) {
debuggedProcess . Paused + = debuggedProcess_DebuggingPaused ;
debuggedProcess . ExceptionThrown + = debuggedProcess_ExceptionThrown ;
debuggedProcess . Resumed + = debuggedProcess_DebuggingResumed ;
debuggedProcess . ModulesAdded + = debuggedProcess_ModulesAdded ;
debuggedProcess . BreakAtBeginning = BreakAtBeginning ;
}
// reset
BreakAtBeginning = false ;
JumpToCurrentLine ( ) ;
process . ModuleLoaded + = ( s , e ) = > UpdateBreakpointIcons ( ) ;
OnProcessSelected ( new ProcessEventArgs ( process ) ) ;
process . ModuleLoaded + = ( s , e ) = > RefreshPads ( e ) ;
process . ModuleUnloaded + = ( s , e ) = > RefreshPads ( e ) ;
process . LogMessage + = LogMessage ;
process . Paused + = debuggedProcess_DebuggingPaused ;
process . Resumed + = debuggedProcess_DebuggingResumed ;
process . Exited + = ( s , e ) = > debugger_ProcessExited ( e . Process ) ;
UpdateBreakpointIcons ( ) ;
}
}
void debuggedProcess_ModulesAdded ( object sender , ModuleEventArgs e )
void debugger_ProcessExited ( Process process )
{
{
var currentModuleTypes = e . Module . GetNamesOfDefinedTypes ( ) ;
if ( DebugStopped ! = null ) {
foreach ( var bookmark in DebuggerService . Breakpoints . OfType < DecompiledBreakpointBookmark > ( ) ) {
DebugStopped ( this , EventArgs . Empty ) ;
var breakpoint = debugger . Breakpoints . FirstOrDefault (
b = > b is ILBreakpoint & & b . Line = = bookmark . LineNumber & &
( ( ILBreakpoint ) b ) . MetadataToken = = bookmark . MemberReference . MetadataToken . ToInt32 ( ) ) ;
if ( breakpoint = = null )
continue ;
// set the breakpoint only if the module contains the type
if ( ! currentModuleTypes . Contains ( breakpoint . TypeName ) )
continue ;
breakpoint . SetBreakpoint ( e . Module ) ;
}
}
debuggedProcess = null ;
UpdateBreakpointIcons ( ) ;
}
}
void debuggedProcess_DebuggingPaused ( object sender , Process EventArgs e )
void debuggedProcess_DebuggingPaused ( object sender , DebuggerEventArgs e )
{
{
OnIsProcessRunningChanged ( EventArgs . Empty ) ;
OnIsProcessRunningChanged ( EventArgs . Empty ) ;
LoggingService . Info ( "Jump to current line" ) ;
LoggingService . Info ( "Jump to current line" ) ;
JumpToCurrentLine ( ) ;
JumpToCurrentLine ( ) ;
// TODO update tooltip
if ( e . ExceptionThrown ! = null ) {
/ * if ( currentTooltipRow ! = null & & currentTooltipRow . IsShown ) {
HandleException ( e ) ;
using ( new PrintTimes ( "Update tooltip" ) ) {
}
try {
Utils . DoEvents ( debuggedProcess ) ;
foreach ( Breakpoint breakpoint in e . BreakpointsHit ) {
AbstractNode updatedNode = ValueNode . Create ( currentTooltipExpression ) ;
var bookmark = BookmarkManager . Bookmarks . OfType < BreakpointBookmark > ( ) . First ( bm = > bm . InternalBreakpointObject = = breakpoint ) ;
currentTooltipRow . SetContentRecursive ( updatedNode ) ;
} catch ( AbortedBecauseDebuggeeResumedException ) {
LoggingService . Debug ( bookmark . Action + " " + bookmark . ScriptLanguage + " " + bookmark . Condition ) ;
}
switch ( bookmark . Action ) {
case BreakpointAction . Break :
break ;
case BreakpointAction . Condition :
if ( Evaluate ( bookmark . Condition , bookmark . ScriptLanguage ) )
DebuggerService . PrintDebugMessage ( string . Format ( StringParser . Parse ( "${res:MainWindow.Windows.Debug.Conditional.Breakpoints.BreakpointHitAtBecause}" ) + "\n" , bookmark . LineNumber , bookmark . FileName , bookmark . Condition ) ) ;
else
this . debuggedProcess . AsyncContinue ( ) ;
break ;
case BreakpointAction . Trace :
DebuggerService . PrintDebugMessage ( string . Format ( StringParser . Parse ( "${res:MainWindow.Windows.Debug.Conditional.Breakpoints.BreakpointHitAt}" ) + "\n" , bookmark . LineNumber , bookmark . FileName ) ) ;
break ;
}
}
} * /
}
RefreshPads ( e ) ;
}
}
void debuggedProcess_DebuggingResumed ( object sender , ProcessEventArgs e )
void debuggedProcess_DebuggingResumed ( object sender , Debugger EventArgs e )
{
{
OnIsProcessRunningChanged ( EventArgs . Empty ) ;
OnIsProcessRunningChanged ( EventArgs . Empty ) ;
DebuggerService . RemoveCurrentLineMarker ( ) ;
DebuggerService . RemoveCurrentLineMarker ( ) ;
RefreshPads ( e ) ;
}
}
void debuggedProcess_ExceptionThrown ( object sender , ExceptionEventArgs e )
void HandleException ( Debugger EventArgs e )
{
{
JumpToCurrentLine ( ) ;
JumpToCurrentLine ( ) ;
StringBuilder stacktraceBuilder = new StringBuilder ( ) ;
StringBuilder stacktraceBuilder = new StringBuilder ( ) ;
if ( e . IsUnhandled ) {
if ( e . ExceptionThrown . IsUnhandled ) {
// Need to intercept now so that we can evaluate properties
// Need to intercept now so that we can evaluate properties
if ( e . Process . SelectedThread . InterceptException ( e . Exception ) ) {
if ( e . Process . SelectedThread . InterceptException ( e . ExceptionThrown ) ) {
stacktraceBuilder . AppendLine ( e . Exception . ToString ( ) ) ;
stacktraceBuilder . AppendLine ( e . ExceptionThrown . ToString ( ) ) ;
string stackTrace ;
string stackTrace ;
try {
try {
stackTrace = e . Exception . GetStackTrace ( StringParser . Parse ( "${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.EndOfInnerException}" ) ) ;
stackTrace = e . ExceptionThrown . GetStackTrace ( StringParser . Parse ( "${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.EndOfInnerException}" ) ) ;
} catch ( GetValueException ) {
} catch ( GetValueException ) {
stackTrace = e . Process . SelectedThread . GetStackTrace ( StringParser . Parse ( "${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.Symbols}" ) , StringParser . Parse ( "${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.NoSymbols}" ) ) ;
stackTrace = e . Process . SelectedThread . GetStackTrace ( StringParser . Parse ( "${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.Symbols}" ) , StringParser . Parse ( "${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.NoSymbols}" ) ) ;
}
}
@ -848,19 +735,19 @@ namespace ICSharpCode.SharpDevelop.Services
} else {
} else {
// For example, happens on stack overflow
// For example, happens on stack overflow
stacktraceBuilder . AppendLine ( StringParser . Parse ( "${res:MainWindow.Windows.Debug.ExceptionForm.Error.CannotInterceptException}" ) ) ;
stacktraceBuilder . AppendLine ( StringParser . Parse ( "${res:MainWindow.Windows.Debug.ExceptionForm.Error.CannotInterceptException}" ) ) ;
stacktraceBuilder . AppendLine ( e . Exception . ToString ( ) ) ;
stacktraceBuilder . AppendLine ( e . ExceptionThrown . ToString ( ) ) ;
stacktraceBuilder . Append ( e . Process . SelectedThread . GetStackTrace ( StringParser . Parse ( "${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.Symbols}" ) , StringParser . Parse ( "${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.NoSymbols}" ) ) ) ;
stacktraceBuilder . Append ( e . Process . SelectedThread . GetStackTrace ( StringParser . Parse ( "${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.Symbols}" ) , StringParser . Parse ( "${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.NoSymbols}" ) ) ) ;
}
}
} else {
} else {
stacktraceBuilder . AppendLine ( e . Exception . ToString ( ) ) ;
stacktraceBuilder . AppendLine ( e . ExceptionThrown . ToString ( ) ) ;
stacktraceBuilder . Append ( e . Process . SelectedThread . GetStackTrace ( StringParser . Parse ( "${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.Symbols}" ) , StringParser . Parse ( "${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.NoSymbols}" ) ) ) ;
stacktraceBuilder . Append ( e . Process . SelectedThread . GetStackTrace ( StringParser . Parse ( "${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.Symbols}" ) , StringParser . Parse ( "${res:MainWindow.Windows.Debug.ExceptionForm.LineFormat.NoSymbols}" ) ) ) ;
}
}
string title = e . IsUnhandled ? StringParser . Parse ( "${res:MainWindow.Windows.Debug.ExceptionForm.Title.Unhandled}" ) : StringParser . Parse ( "${res:MainWindow.Windows.Debug.ExceptionForm.Title.Handled}" ) ;
string title = e . ExceptionThrown . IsUnhandled ? StringParser . Parse ( "${res:MainWindow.Windows.Debug.ExceptionForm.Title.Unhandled}" ) : StringParser . Parse ( "${res:MainWindow.Windows.Debug.ExceptionForm.Title.Handled}" ) ;
string message = string . Format ( StringParser . Parse ( "${res:MainWindow.Windows.Debug.ExceptionForm.Message}" ) , e . Exception . Type ) ;
string message = string . Format ( StringParser . Parse ( "${res:MainWindow.Windows.Debug.ExceptionForm.Message}" ) , e . ExceptionThrown . Type ) ;
Bitmap icon = WinFormsResourceService . GetBitmap ( e . IsUnhandled ? "Icons.32x32.Error" : "Icons.32x32.Warning" ) ;
Bitmap icon = WinFormsResourceService . GetBitmap ( e . ExceptionThrown . IsUnhandled ? "Icons.32x32.Error" : "Icons.32x32.Warning" ) ;
DebuggeeExceptionForm . Show ( debuggedProcess , title , message , stacktraceBuilder . ToString ( ) , icon , e . IsUnhandled , e . Exception ) ;
DebuggeeExceptionForm . Show ( debuggedProcess , title , message , stacktraceBuilder . ToString ( ) , icon , e . ExceptionThrown . IsUnhandled , e . ExceptionThrow n ) ;
}
}
public bool BreakAndInterceptHandledException ( Debugger . Exception exception )
public bool BreakAndInterceptHandledException ( Debugger . Exception exception )
@ -961,14 +848,14 @@ namespace ICSharpCode.SharpDevelop.Services
return ( StopAttachedProcessDialogResult ) MessageService . ShowCustomDialog ( caption , message , ( int ) StopAttachedProcessDialogResult . Detach , ( int ) StopAttachedProcessDialogResult . Cancel , buttonLabels ) ;
return ( StopAttachedProcessDialogResult ) MessageService . ShowCustomDialog ( caption , message , ( int ) StopAttachedProcessDialogResult . Detach , ( int ) StopAttachedProcessDialogResult . Cancel , buttonLabels ) ;
}
}
void process_Modules_Added ( object sender , CollectionItemEventArgs < Module > e )
void process_Modules_Added ( object sender , ModuleEventArgs e )
{
{
if ( ProjectService . OpenSolution = = null )
if ( ProjectService . OpenSolution = = null )
return ;
return ;
ProjectService . OpenSolution . Projects
ProjectService . OpenSolution . Projects
. Where ( p = > e . Item . Name . IndexOf ( p . Name ) > = 0 )
. Where ( p = > e . Module . Name . IndexOf ( p . Name ) > = 0 )
. ForEach ( p = > e . Item . LoadSymbolsFromDisk ( new [ ] { Path . GetDirectoryName ( p . OutputAssemblyFullPath ) } ) ) ;
. ForEach ( p = > e . Module . LoadSymbolsFromDisk ( new [ ] { Path . GetDirectoryName ( p . OutputAssemblyFullPath ) } ) ) ;
}
}
}
}
}
}