Skip to content

Commit

Permalink
Add "sendInvalidate" request (#1367)
Browse files Browse the repository at this point in the history
* parent 603fa9c
author Sergey <sergey.bobko@intel.com> 1667223527 -0700
committer Sergey Bobko <sergey.bobko@intel.com> 1680535841 +0000

Add "sendInvalidate" request

This PR adds support for OpenDebugAD7 to handle `sendInvalidate` requests which will respond if it successfully fired an InvalidatedEvent to the UI.

Here is the schema:
```json
"SendInvalidateRequest": {
    "allOf": [
        {
            "$ref": "#/definitions/Request"
        },
        {
            "type": "object",
            "properties": {
               "areas": {
                  "type": "array",
                  "description": "Set of logical areas that got invalidated. This property has a hint characteristic: a client can only be expected to make a 'best effort' in honoring the areas but there are no guarantees. If this property is missing, empty, or if values are not understood, the client should assume a single value `all`.",
                  "items": {
                     "$ref": "#/definitions/InvalidatedAreas"
                  }
               },
                "threadId": {
                    "type": "int",
                },
                "stackFrameId": {
                    "type": "int",
                },
            },
            "required": [
                "areas"
            ]
        }
    ]
},
```

Co-authored-by: Andrew Wang <waan@microsoft.com>
  • Loading branch information
sbobko and WardenGnaw authored Apr 17, 2023
1 parent 17d1252 commit c4ad01a
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/OpenDebugAD7/AD7DebugSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,35 @@ public AD7DebugSession(Stream debugAdapterStdIn, Stream debugAdapterStdOut, List
m_dataBreakpoints = new Dictionary<string, IDebugPendingBreakpoint2>();
m_exceptionBreakpoints = new List<string>();
m_variableManager = new VariableManager();

//Register sendInvalidate request
Protocol.RegisterRequestType<SendInvalidateRequest, SendInvalidateArguments>(r => this.HandleSendInvalidateRequestAsync(r));

}

private void HandleSendInvalidateRequestAsync(IRequestResponder<SendInvalidateArguments> responder)
{
InvalidatedEvent invalidated = new InvalidatedEvent();

// Setting the area and adding it to the result
invalidated.Areas.Add(responder.Arguments.Areas);

// Setting the StackFrameId if passed (and the 'threadId' is ignored).
if (null != responder.Arguments.StackFrameId)
{
invalidated.StackFrameId = responder.Arguments.StackFrameId;
}

// Setting the ThreadId if passed
else if (null != responder.Arguments.ThreadId)
{
invalidated.ThreadId = responder.Arguments.ThreadId;
}


Protocol.SendEvent(invalidated);

}
#endregion

#region Utility
Expand Down Expand Up @@ -3874,4 +3901,21 @@ int IDebugSettingsCallback110.ShouldSuppressImplicitToStringCalls(out int pfSupp
}
}
}

internal class SendInvalidateRequest : DebugRequest<SendInvalidateArguments>
{

public SendInvalidateRequest(): base("sendInvalidate")
{
}
}

internal class SendInvalidateArguments : DebugRequestArguments
{

public InvalidatedAreas Areas { get; set; }
public int? ThreadId { get; set; }
public int? StackFrameId { get; set; }

}
}

0 comments on commit c4ad01a

Please sign in to comment.