Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix LogPoint Issue + Add IgnoreResponseOrder in DAR #1208

Merged
merged 8 commits into from
Aug 31, 2021

Conversation

WardenGnaw
Copy link
Member

@WardenGnaw WardenGnaw commented Aug 28, 2021

Customer reported in v1.6.0 that LogPoints stopped working and are treated like regular breakpoints.
This was due to IDebugBreakpointEvent2.EnumBreakpoints returning the
same IEnumDebugBoundBreakpoints2.

The fix was to save IDebugBoundBreakpoint2[] in the event and return a
new IEnumDebugBoundBreakpoints2 object per call.

Added a test for logpoints and fixed up ConsoleEvent to be OutputEvent
since thats what it should actually be.

Added flag IgnoreResponseOrder to allow looking at historical responses to find out if the expected response occurred before.

Customer reported in v1.6.0 that LogPoints stopped working.
This was due to IDebugBreakpointEvent2.EnumBreakpoints returning the
same IEnumDebugBoundBreakpoints2.

The fix was to save IDebugBoundBreakpoint2[] in the event and return a
new IEnumDebugBoundBreakpoints2 object per call.

Added a test for logpoints and fixed up ConsoleEvent to be OutputEvent
since thats what it should actually be.
@gregg-miskelly
Copy link
Member

gregg-miskelly commented Aug 31, 2021

                string expectedResponseText = JsonConvert.SerializeObject(this.ExpectedResponses[currentExpectedResponseIndex].Response);

To make these issues easier to debug in the future, I would suggest we change the expected format to be more like the actual.

Something like:

for (int i = 0; i < ExpectedResponses.Lenght; i++)
{
    string status;
    if (i < currentExpectedResponseIndex)
        status = "Found" ;
    else if (i == currentExpectedResponseIndex)
        status = "Not Found";
    else
        status = "Not searched yet";
    expectedResponseText += string.Format(CultureInfo.CurrentCulture, "{0}. {1}: {2}\n", (i + 1), status, JsonConvert.SerializeObject(ExpectedResponses[i].Response));
}

Refers to: test/DebugAdapterRunner/DebugAdapterCommand.cs:242 in 7249fbd. [](commit_id = 7249fbd, deletion_comment = False)

@WardenGnaw
Copy link
Member Author

                string expectedResponseText = JsonConvert.SerializeObject(this.ExpectedResponses[currentExpectedResponseIndex].Response);

To make these issues easier to debug in the future, I would suggest we change the expected format to be more like the actual.

Something like:

for (int i = 0; i < ExpectedResponses.Lenght; i++)
{
    string status;
    if (i < currentExpectedResponseIndex)
        status = "Found" ;
    else if (i == currentExpectedResponseIndex)
        status = "Not Found";
    else
        status = "Not searched yet";
    expectedResponseText += string.Format(CultureInfo.CurrentCulture, "{0}. {1}: {2}\n", (i + 1), status, JsonConvert.SerializeObject(ExpectedResponses[i].Response));
}

Refers to: test/DebugAdapterRunner/DebugAdapterCommand.cs:242 in 7249fbd. [](commit_id = 7249fbd, deletion_comment = False)

Example Test failure log:

 DARException: Expected response not found before timeout.
 Expected = 1. Found: {"success":true,"command":"continue"}
 2. Not Found: {"body":{"output":"^Log Message\\b","category":"console"},"event":"output"}
 3. Not searched yet: {"body":{},"event":"exited"}
 4. Not searched yet: {"event":"terminated"}

 Actual Responses =
 1. {"Seen":false,"Response":{"event":"breakpoint","body":{"reason":"changed","breakpoint":{"id":2,"verified":true,"line":52,"BoundBreakpoints":[]}},"seq":40,"type":"event"}}
 2. {"Seen":false,"Response":{"event":"output","body":{"category":"stdout","output":"Calling recursive function.\n"},"seq":42,"type":"event"}}
 3. {"Seen":false,"Response":{"event":"output","body":{"category":"stdout","output":"\n"},"seq":43,"type":"event"}}
 4. {"Seen":false,"Response":{"event":"output","body":{"category":"stdout","output":"Breakpoint 3, Calling::CoreRun (this=0x7ffffffedd90) at /mnt/d/dd/MIEngine/bin/DebugAdapterProtocolTests/Debug/CppTests/debuggees/instance/kitchensink-3/src/calling.cpp:52\n"},"seq":44,"type":"event"}}
 5. {"Seen":false,"Response":{"event":"output","body":{"category":"stdout","output":"52\t    this->Log(\"Calling variable arg function.\");\n"},"seq":45,"type":"event"}}
 6. {"Seen":true,"Response":{"success":true,"message":null,"request_seq":6,"command":"continue","body":{},"running":false,"refs":null,"seq":41,"type":"response"}}
 7. {"Seen":false,"Response":{"event":"stopped","body":{"reason":"breakpoint","threadId":6195,"allThreadsStopped":true,"source":{"name":"calling.cpp","path":"/mnt/d/dd/MIEngine/bin/DebugAdapterProtocolTests/Debug/CppTests/debuggees/instance/kitchensink-3/src/calling.cpp","sources":[],"checksums":[]},"line":52,"column":1},"seq":46,"type":"event"}}

@gregg-miskelly
Copy link
Member

Two nits:

 DARException: Expected response not found before timeout.
 Expected = 1. Found: {"success":true,"command":"continue"}
 2. Not Found: {"body":{"output":"^Log Message\\b","category":"console"},"event":"output"}

I think you want a new line after Expected =

Actual Responses =

  1. {"Seen":false,"Response":{"event":"breakpoint","body":{"reason":"changed","breakpoint":{"id":2,"verified":true,"line":52,"BoundBreakpoints":[]}},"seq":40,"type":"event"}}
  2. {"Seen":false,"Response":{"event":"output","body":{"category":"stdout","output":"Calling recursive function.\n"},"seq":42,"type":"event"}}

Since it will show up in the log, I would suggest renaming 'Seen' to 'FoundMatch'

@WardenGnaw WardenGnaw changed the title Fix LogPoint Issue Fix LogPoint Issue + Add IgnoreResponseOrder in DAR Aug 31, 2021
@WardenGnaw WardenGnaw merged commit 4808cbd into main Aug 31, 2021
@WardenGnaw WardenGnaw deleted the dev/waan/fixLogPoints branch September 21, 2021 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants