Skip to content

Commit

Permalink
Exception Debugging Core
Browse files Browse the repository at this point in the history
  • Loading branch information
GreenMatan committed Feb 8, 2024
1 parent d34e232 commit 57fc175
Show file tree
Hide file tree
Showing 48 changed files with 3,056 additions and 143 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@
<type fullname="System.IntPtr" />
<type fullname="System.InvalidCastException" />
<type fullname="System.InvalidOperationException" />
<type fullname="System.InvalidProgramException" />
<type fullname="System.IO.BinaryReader" />
<type fullname="System.IO.BinaryWriter" />
<type fullname="System.IO.Directory" />
Expand Down Expand Up @@ -824,6 +825,7 @@
<type fullname="System.TypeCode" />
<type fullname="System.TypedReference" />
<type fullname="System.TypeInitializationException" />
<type fullname="System.TypeLoadException" />
<type fullname="System.UInt16" />
<type fullname="System.UInt32" />
<type fullname="System.UInt64" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// <copyright file="AggregateExceptionRelatedFrames.cs" company="Datadog">
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
// </copyright>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Datadog.Trace.Debugger.ExceptionAutoInstrumentation
{
internal class AggregateExceptionRelatedFrames : ExceptionRelatedFrames
{
public AggregateExceptionRelatedFrames(AggregateException ex, ParticipatingFrame[] frames, ExceptionRelatedFrames[] innerFrames)
: base(ex, frames)
{
InnerFrames = innerFrames;
}

public ExceptionRelatedFrames[] InnerFrames { get; }

public override IEnumerable<ParticipatingFrame> GetAllFlattenedFrames()
{
foreach (var frame in InnerFrames.SelectMany(innerFrame => innerFrame?.GetAllFlattenedFrames()))
{
yield return frame;
}

foreach (var frame in Frames)
{
yield return frame;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// <copyright file="DebuggerSnapshot.cs" company="Datadog">
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
// </copyright>

using System;

namespace Datadog.Trace.Debugger.ExceptionAutoInstrumentation;

internal class DebuggerSnapshot
{
public DebuggerSnapshot(string probeId, string snapshot, Exception exceptionThrown, Guid snapshotId)
{
ProbeId = probeId;
Snapshot = snapshot;
ExceptionThrown = exceptionThrown;
SnapshotId = snapshotId;
}

public DebuggerSnapshot Child { get; set; }

public string ProbeId { get; }

public string Snapshot { get; }

public Exception ExceptionThrown { get; }

public Guid SnapshotId { get; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// <copyright file="ErrorOriginType.cs" company="Datadog">
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
// </copyright>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Datadog.Trace.Debugger.ExceptionAutoInstrumentation
{
internal enum ErrorOriginType : byte
{
/// <summary>
/// A first-chance exception is any exception that is initially thrown.
/// </summary>
FirstChanceException,

/// <summary>
/// A second chance exception is an unhandled exception that has propagated
/// to the top of the stack and is about to crash the process.
/// </summary>
SecondChanceException,

/// <summary>
/// An exception that was sent to a logging tool - e.g. via a call to Logger.Error(...)
/// </summary>
LoggedError,

/// <summary>
/// In ASP.NET / ASP.NET Core / WebAPI etc, an HTTP request failure exception is
/// an exception in that will cause the request to return a failure response code (usually HTTP 500).
/// </summary>
HttpRequestFailure,

/// <summary>
/// The shadow stack knows when a catch statement ends. When it does, it calls an exception event.
/// For first-chance exception it means this instance will have the full StackTrace.
/// </summary>
ExceptionCaught
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// <copyright file="ExceptionCollectionState.cs" company="Datadog">
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
// </copyright>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Datadog.Trace.Debugger.ExceptionAutoInstrumentation
{
internal enum ExceptionCollectionState : byte
{
Done,
Initializing,
Collecting,
Finalizing,
None
}
}
Loading

0 comments on commit 57fc175

Please sign in to comment.