public void Execute(CommandExecutionContext context)
{
if (ExceptionAddress != 0)
{
var heap = context.Runtime.GetHeap();
var type = heap.GetObjectType(ExceptionAddress);
if (type == null || !type.IsException)
{
context.WriteError("The specified address is not the address of an Exception-derived object.");
return;
}
DisplayException(heap.GetExceptionObject(ExceptionAddress), context);
}
else
{
var thread = context.CurrentThread;
if (thread == null)
{
context.WriteError("There is no current managed thread");
return;
}
if (thread.CurrentException == null)
{
context.WriteLine("There is no current managed exception on this thread");
return;
}
DisplayException(thread.CurrentException, context);
}
}