Browse Source

Exception dialog uses TextBox and is bit more informative

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@248 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 21 years ago
parent
commit
b0f3900260
  1. 42
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/ExceptionForm.cs
  2. 17
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs
  3. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs
  4. 20
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Exception.cs

42
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/ExceptionForm.cs

@ -7,6 +7,8 @@ @@ -7,6 +7,8 @@
using System;
using System.Windows.Forms;
using ICSharpCode.Core;
using DebuggerLibrary;
namespace ICSharpCode.SharpDevelop.Services
{
@ -14,20 +16,33 @@ namespace ICSharpCode.SharpDevelop.Services @@ -14,20 +16,33 @@ namespace ICSharpCode.SharpDevelop.Services
{
public enum Result {Break, Continue, Ignore};
public Result result = Result.Continue;
private Result result = Result.Continue;
public System.Windows.Forms.Label label;
private System.Windows.Forms.TextBox textBox;
private System.Windows.Forms.Button buttonContinue;
private System.Windows.Forms.Button buttonIgnore;
public System.Windows.Forms.PictureBox pictureBox;
private System.Windows.Forms.PictureBox pictureBox;
private System.Windows.Forms.Button buttonBreak;
public ExceptionForm()
private ExceptionForm()
{
InitializeComponent();
}
public static Result Show(DebuggerLibrary.Exception exception)
{
ExceptionForm form = new ExceptionForm();
form.textBox.Text = "Exception " +
exception.Type +
" was thrown in debugee:\r\n" +
exception.Message + "\r\n\r\n" +
exception.Callstack.Replace("\n","\r\n");
form.pictureBox.Image = ResourceService.GetBitmap((exception.ExceptionType != ExceptionType.DEBUG_EXCEPTION_UNHANDLED)?"Icons.32x32.Warning":"Icons.32x32.Error");
form.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm);
return form.result;
}
#region Windows Forms Designer generated code
/// <summary>
/// This method is required for Windows Forms designer support.
@ -39,7 +54,7 @@ namespace ICSharpCode.SharpDevelop.Services @@ -39,7 +54,7 @@ namespace ICSharpCode.SharpDevelop.Services
this.pictureBox = new System.Windows.Forms.PictureBox();
this.buttonIgnore = new System.Windows.Forms.Button();
this.buttonContinue = new System.Windows.Forms.Button();
this.label = new System.Windows.Forms.Label();
this.textBox = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
this.SuspendLayout();
//
@ -85,19 +100,22 @@ namespace ICSharpCode.SharpDevelop.Services @@ -85,19 +100,22 @@ namespace ICSharpCode.SharpDevelop.Services
//
// label
//
this.label.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
this.textBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.label.Location = new System.Drawing.Point(91, 16);
this.label.Name = "label";
this.label.Size = new System.Drawing.Size(528, 144);
this.label.TabIndex = 4;
this.label.Text = "label";
this.textBox.Location = new System.Drawing.Point(91, 16);
this.textBox.Name = "textBox";
this.textBox.Multiline = true;
this.textBox.WordWrap = false;
this.textBox.ReadOnly = true;
this.textBox.Size = new System.Drawing.Size(528, 138);
this.textBox.TabIndex = 4;
this.textBox.Text = "";
//
// ExceptionForm
//
this.ClientSize = new System.Drawing.Size(638, 203);
this.Controls.Add(this.label);
this.Controls.Add(this.textBox);
this.Controls.Add(this.pictureBox);
this.Controls.Add(this.buttonIgnore);
this.Controls.Add(this.buttonContinue);

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

@ -246,6 +246,7 @@ namespace ICSharpCode.SharpDevelop.Services @@ -246,6 +246,7 @@ namespace ICSharpCode.SharpDevelop.Services
debugger = new NDebugger();
debugger.LogMessage += new EventHandler<MessageEventArgs>(LogMessage);
debugger.DebuggerTraceMessage += new EventHandler<MessageEventArgs>(TraceMessage);
debugger.ProcessStarted += new EventHandler<ProcessEventArgs>(ProcessStarted);
debugger.ProcessExited += new EventHandler<ProcessEventArgs>(ProcessExited);
debugger.DebuggingPaused += new EventHandler<DebuggingPausedEventArgs>(DebuggingPaused);
@ -313,7 +314,12 @@ namespace ICSharpCode.SharpDevelop.Services @@ -313,7 +314,12 @@ namespace ICSharpCode.SharpDevelop.Services
void LogMessage(object sender, MessageEventArgs e)
{
DebuggerService.PrintDebugMessage(e.Message);
DebuggerService.PrintDebugMessage(">" + e.Message);
}
void TraceMessage(object sender, MessageEventArgs e)
{
DebuggerService.PrintDebugMessage(e.Message + "\n");
}
void ProcessStarted(object sender, ProcessEventArgs e)
@ -349,14 +355,7 @@ namespace ICSharpCode.SharpDevelop.Services @@ -349,14 +355,7 @@ namespace ICSharpCode.SharpDevelop.Services
JumpToCurrentLine();
ExceptionForm form = new ExceptionForm();
form.label.Text = "Exception " +
debugger.CurrentThread.CurrentException.Type +
" was thrown in debugee:\n" +
debugger.CurrentThread.CurrentException.Message;
form.pictureBox.Image = ResourceService.GetBitmap((debugger.CurrentThread.CurrentException.ExceptionType != ExceptionType.DEBUG_EXCEPTION_UNHANDLED)?"Icons.32x32.Warning":"Icons.32x32.Error");
form.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm);
switch (form.result) {
switch (ExceptionForm.Show(debugger.CurrentThread.CurrentException)) {
case ExceptionForm.Result.Break:
break;
case ExceptionForm.Result.Continue:

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

@ -144,7 +144,7 @@ namespace DebuggerLibrary @@ -144,7 +144,7 @@ namespace DebuggerLibrary
protected internal virtual void OnLogMessage(string message)
{
TraceMessage ("Debugger event: OnLogMessage(\"" + message + "\")");
TraceMessage ("Debugger event: OnLogMessage");
if (LogMessage != null) {
LogMessage(this, new MessageEventArgs(this, message));
}

20
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Exception.cs

@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
// </file>
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading;
@ -24,6 +25,7 @@ namespace DebuggerLibrary @@ -24,6 +25,7 @@ namespace DebuggerLibrary
ExceptionType exceptionType;
SourcecodeSegment location;
DateTime creationTime;
string callstack;
string type;
string message;
@ -47,7 +49,17 @@ namespace DebuggerLibrary @@ -47,7 +49,17 @@ namespace DebuggerLibrary
message = runtimeVariableException.SubVariables["_message"].Value.ToString();
}
location = thread.CurrentFunction.NextStatement;
location = thread.LastFunctionWithLoadedSymbols.NextStatement;
callstack = "";
foreach(Function function in thread.Callstack) {
SourcecodeSegment loc = function.NextStatement;
callstack += function.Name + "()";
if (loc != null) {
callstack += " - " + loc.SourceFullFilename + ":" + loc.StartLine + "," + loc.StartColumn;
}
callstack += "\n";
}
type = runtimeVariable.Type;
}
@ -68,6 +80,12 @@ namespace DebuggerLibrary @@ -68,6 +80,12 @@ namespace DebuggerLibrary
return message;
}
}
public string Callstack {
get {
return callstack;
}
}
public ExceptionType ExceptionType{
get {

Loading…
Cancel
Save