Browse Source
Added "$exception" variable to the local variables pad. ExceptionForm generalized to DebuggerEventForm. Permanently removed exception history pad. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3099 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
21 changed files with 253 additions and 533 deletions
@ -1,157 +0,0 @@
@@ -1,157 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
#region License
|
||||
//
|
||||
// Copyright (c) 2007, ic#code
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. Neither the name of the ic#code nor the names of its contributors may be
|
||||
// used to endorse or promote products derived from this software without
|
||||
// specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
#endregion
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Drawing; |
||||
using System.Windows.Forms; |
||||
|
||||
using Debugger; |
||||
using ICSharpCode.Core; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Gui.Pads |
||||
{ |
||||
public class ExceptionHistoryPad : DebuggerPad |
||||
{ |
||||
ListView exceptionHistoryList; |
||||
Debugger.Process debuggedProcess; |
||||
|
||||
List<Debugger.Exception> exceptions = new List<Debugger.Exception>(); |
||||
|
||||
ColumnHeader time = new ColumnHeader(); |
||||
ColumnHeader exception = new ColumnHeader(); |
||||
ColumnHeader location = new ColumnHeader(); |
||||
|
||||
public override Control Control { |
||||
get { |
||||
return exceptionHistoryList; |
||||
} |
||||
} |
||||
|
||||
protected override void InitializeComponents() |
||||
{ |
||||
exceptionHistoryList = new ListView(); |
||||
exceptionHistoryList.FullRowSelect = true; |
||||
exceptionHistoryList.AutoArrange = true; |
||||
exceptionHistoryList.Alignment = ListViewAlignment.Left; |
||||
exceptionHistoryList.View = View.Details; |
||||
exceptionHistoryList.Dock = DockStyle.Fill; |
||||
exceptionHistoryList.GridLines = false; |
||||
exceptionHistoryList.Activation = ItemActivation.OneClick; |
||||
exceptionHistoryList.Columns.AddRange(new ColumnHeader[] {time, exception, location} ); |
||||
exceptionHistoryList.ItemActivate += new EventHandler(ExceptionHistoryListItemActivate); |
||||
exception.Width = 300; |
||||
location.Width = 400; |
||||
time.Width = 80; |
||||
|
||||
RedrawContent(); |
||||
} |
||||
|
||||
public override void RedrawContent() |
||||
{ |
||||
time.Text = ResourceService.GetString("MainWindow.Windows.Debug.ExceptionHistory.Time"); |
||||
exception.Text = ResourceService.GetString("MainWindow.Windows.Debug.ExceptionHistory.Exception"); |
||||
location.Text = ResourceService.GetString("AddIns.HtmlHelp2.Location"); |
||||
} |
||||
|
||||
protected override void SelectProcess(Debugger.Process process) |
||||
{ |
||||
if (debuggedProcess != null) { |
||||
debuggedProcess.ExceptionThrown -= debuggedProcess_ExceptionThrown; |
||||
} |
||||
debuggedProcess = process; |
||||
if (debuggedProcess != null) { |
||||
debuggedProcess.ExceptionThrown += debuggedProcess_ExceptionThrown; |
||||
} |
||||
exceptions.Clear(); |
||||
RefreshPad(); |
||||
} |
||||
|
||||
void debuggedProcess_ExceptionThrown(object sender, ExceptionEventArgs e) |
||||
{ |
||||
exceptions.Add(e.Exception); |
||||
RefreshPad(); |
||||
} |
||||
|
||||
void ExceptionHistoryListItemActivate(object sender, EventArgs e) |
||||
{ |
||||
SourcecodeSegment nextStatement = ((Debugger.Exception)(exceptionHistoryList.SelectedItems[0].Tag)).Location; |
||||
|
||||
if (nextStatement == null) { |
||||
return; |
||||
} |
||||
|
||||
FileService.OpenFile(nextStatement.SourceFullFilename); |
||||
IViewContent content = FileService.GetOpenFile(nextStatement.SourceFullFilename); |
||||
|
||||
if (content is IPositionable) { |
||||
((IPositionable)content).JumpTo((int)nextStatement.StartLine - 1, (int)nextStatement.StartColumn - 1); |
||||
} |
||||
} |
||||
|
||||
public override void RefreshPad() |
||||
{ |
||||
exceptionHistoryList.BeginUpdate(); |
||||
exceptionHistoryList.Items.Clear(); |
||||
|
||||
foreach(Debugger.Exception exception in exceptions) { |
||||
string location; |
||||
if (exception.Location != null) { |
||||
location = exception.Location.SourceFilename + ":" + exception.Location.StartLine; |
||||
} else { |
||||
location = ResourceService.GetString("Global.NA"); |
||||
} |
||||
location += " (type=" + exception.ExceptionType.ToString() + ")"; |
||||
ListViewItem item = new ListViewItem(new string[] {"" , exception.Type + " - " + exception.Message, location}); |
||||
item.Tag = exception; |
||||
item.ForeColor = Color.Black; |
||||
if (exception.ExceptionType == ExceptionType.DEBUG_EXCEPTION_UNHANDLED) { |
||||
item.ForeColor = Color.Red; |
||||
} |
||||
if (exception.ExceptionType == ExceptionType.DEBUG_EXCEPTION_FIRST_CHANCE || |
||||
exception.ExceptionType == ExceptionType.DEBUG_EXCEPTION_USER_FIRST_CHANCE) { |
||||
item.ForeColor = Color.Blue; |
||||
} |
||||
exceptionHistoryList.Items.Add(item); |
||||
} |
||||
|
||||
exceptionHistoryList.EndUpdate(); |
||||
} |
||||
} |
||||
} |
||||
@ -1,52 +0,0 @@
@@ -1,52 +0,0 @@
|
||||
// <file>
|
||||
// <copyright license="BSD-new" see="prj:///COPYING"/>
|
||||
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
|
||||
// <version>$Revision: 3047 $</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Collections.ObjectModel; |
||||
using System.Drawing; |
||||
using System.Windows.Forms; |
||||
|
||||
using Aga.Controls.Tree; |
||||
|
||||
using Debugger.Util; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Gui.Pads; |
||||
|
||||
namespace Debugger.AddIn.TreeModel |
||||
{ |
||||
/// <summary>
|
||||
/// This TreeNodeAdv displays exception data.
|
||||
/// </summary>
|
||||
public class TreeViewExceptionNode: TreeNodeAdv |
||||
{ |
||||
private static Dictionary<string, bool> expandedNodes = new Dictionary<string, bool>(); |
||||
|
||||
private TreeViewAdv localVarList; |
||||
|
||||
/// <summary>
|
||||
/// The content of the exception
|
||||
/// </summary>
|
||||
private AbstractNode content; |
||||
|
||||
// TODO: I don't know if I need localVarList
|
||||
private TreeViewExceptionNode(TreeViewAdv localVarList, ExceptionNode exception): base(localVarList, new object()) { |
||||
this.localVarList = localVarList; |
||||
SetContentRecursive(exception); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// A simple form of SetContentRecursive that changes the current ChildViewNode to
|
||||
/// display the exception parameter passed to it. If the node had any children and is expanded,
|
||||
/// it will recureively set those as well.
|
||||
/// </summary>
|
||||
/// <param name="exception">Contains the exception that will be stored in this particular TreeViewNode.</param>
|
||||
public static void SetContentRecursive(ExceptionNode exception) { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
} |
||||
@ -1,46 +0,0 @@
@@ -1,46 +0,0 @@
|
||||
// <file>
|
||||
// <copyright license="BSD-new" see="prj:///COPYING"/>
|
||||
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
|
||||
// <version>$Revision: 2813 $</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
|
||||
|
||||
namespace Debugger.AddIn.TreeModel |
||||
{ |
||||
/// <summary>
|
||||
/// Represents a row in a TreeViewAdv that contains an IDebugeeException
|
||||
/// </summary>
|
||||
public class ExceptionNode : AbstractNode |
||||
{ |
||||
private IDebugeeException exception; |
||||
private ExceptionNode innerException = null; |
||||
|
||||
public static ExceptionNode Create(Debugger.Exception exception) { |
||||
try { |
||||
return new ExceptionNode(exception); |
||||
} catch (GetValueException e) { |
||||
// TODO: Fix this
|
||||
throw; |
||||
//return new ErrorNode(expression, e);
|
||||
} |
||||
} |
||||
|
||||
private ExceptionNode(IDebugeeException exception){ |
||||
this.exception = exception; |
||||
this.Image = DebuggerIcons.ImageList.Images[0]; // Class
|
||||
this.Name = "Unhandled Exception"; |
||||
this.Type = exception.Type; |
||||
this.Text = exception.Message; |
||||
if (exception.InnerException != null) { |
||||
innerException = new ExceptionNode(exception.InnerException); |
||||
} |
||||
} |
||||
|
||||
|
||||
ExceptionNode InnerException { |
||||
get { return innerException; } |
||||
} |
||||
} |
||||
} |
||||
@ -1,69 +0,0 @@
@@ -1,69 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="Justin Dearing" email="zippy1981@gmail.com"/>
|
||||
// <version>$Revision: 2900 $</version>
|
||||
// </file>
|
||||
|
||||
using System.Text; |
||||
using Debugger.Wrappers.CorDebug; |
||||
|
||||
namespace Debugger |
||||
{ |
||||
/// <summary>
|
||||
/// This contains the nested InnerExceptions of a <c>Debugger.Exception</c> class
|
||||
/// </summary>
|
||||
/// <see cref="Debugger.Exception" />
|
||||
/// <seealso cref="System.Exception" />
|
||||
public class DebugeeInnerException : IDebugeeException |
||||
{ |
||||
Debugger.Value exceptionValue; |
||||
|
||||
internal DebugeeInnerException (Debugger.Value exception) |
||||
{ |
||||
this.exceptionValue = exception; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// The <c>InnerException</c> property of the exception.
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Exception" />
|
||||
public DebugeeInnerException InnerException { |
||||
get { |
||||
Debugger.Value exVal = this.exceptionValue.GetMemberValue("_innerException"); |
||||
return (exVal.IsNull) ? null : new DebugeeInnerException(exVal); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// The <c>Message</c> property of the exception.
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Exception" />
|
||||
public string Message { |
||||
get { |
||||
return this.exceptionValue.GetMemberValue("_message").AsString; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// The <c>GetType().FullName</c> of the exception.
|
||||
/// </summary>
|
||||
/// <seealso cref="System.Exception" />
|
||||
public string Type { |
||||
get { |
||||
return this.exceptionValue.Type.FullName; |
||||
} |
||||
} |
||||
|
||||
public override string ToString() |
||||
{ |
||||
StringBuilder sb = new StringBuilder(); |
||||
sb.AppendFormat("Type: {0}", this.Type); |
||||
sb.AppendLine(); |
||||
sb.AppendLine("Message:"); |
||||
sb.Append(this.Message); |
||||
|
||||
return sb.ToString(); |
||||
} |
||||
} |
||||
} |
||||
@ -1,21 +0,0 @@
@@ -1,21 +0,0 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
|
||||
// <version>$Revision: 3047 $</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
|
||||
namespace Debugger |
||||
{ |
||||
/// <summary>
|
||||
/// Interface shared by Debugger.Exception and Debugger.DebugeeInnerException.
|
||||
/// </summary>
|
||||
public interface IDebugeeException |
||||
{ |
||||
DebugeeInnerException InnerException { get; } |
||||
string Message { get; } |
||||
string Type { get; } |
||||
} |
||||
} |
||||
@ -0,0 +1,46 @@
@@ -0,0 +1,46 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
|
||||
namespace Debugger.Expressions |
||||
{ |
||||
/// <summary>
|
||||
/// An expression which returns the current exception on the thread
|
||||
/// </summary>
|
||||
public class CurrentExceptionExpression: Expression |
||||
{ |
||||
public override string Code { |
||||
get { |
||||
return "$exception"; |
||||
} |
||||
} |
||||
|
||||
protected override Value EvaluateInternal(StackFrame context) |
||||
{ |
||||
if (context.Thread.CurrentException != null) { |
||||
return context.Thread.CurrentException.Value; |
||||
} else { |
||||
throw new GetValueException("No current exception"); |
||||
} |
||||
} |
||||
|
||||
#region GetHashCode and Equals
|
||||
|
||||
public override int GetHashCode() |
||||
{ |
||||
return typeof(CurrentExceptionExpression).GetHashCode(); |
||||
} |
||||
|
||||
public override bool Equals(object obj) |
||||
{ |
||||
return obj is CurrentExceptionExpression; |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
Binary file not shown.
Loading…
Reference in new issue