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

Test Disassembly view #129161

Closed
2 tasks done
weinand opened this issue Jul 22, 2021 · 10 comments
Closed
2 tasks done

Test Disassembly view #129161

weinand opened this issue Jul 22, 2021 · 10 comments
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues testplan-item
Milestone

Comments

@weinand
Copy link
Contributor

weinand commented Jul 22, 2021

Refs: #124163, #125737

Complexity: 4

Create Issue


Thanks to the C++ team (especially @yuehuang010, @xisui-MSFT) we've received PR #125737 which adds the frequently requested Disassembly View to VS Code.

The Disassembly View supports a single instance only and can be opened from an editor of an active debug session if the corresponding debug extension supports it. The view shows the disassembled source of the editor's content and supports instruction stepping and instruction breakpoints.

Today two debug extensions support the Disassembly View: "C++" and "Mock Debug" (shown in the following recording).

2021-07-22_10-31-24 (1)

C++ setup

Mock Debug Setup

  • install latest "Mock Debug" extension from the Marketplace.
  • create a Markdown file "test.md" and copy the contents of this link into it.
  • set a breakpoint in line 51
  • from the editor's title area select the "Debug File" action from the drop down item:
    2021-07-26_13-37-15
  • once you hit the breakpoint, run the "Open Disassembly View" action from the markdown editor's context menu.

What to test:

  • Right Click menu in the editor should show "Open Disassembly View" only for supported debuggers in an active debug session.
  • Disassembly View:
    • Scrolling up and down should be smooth and infinite, text content should expand
    • Current instruction marker (yellow left pointing arrow) should match with source code event while stepping.
    • When disassembly view is in focus, stepping In/out/back will step individual instructions.
    • Switch back to source code resume normal stepping behavior.
    • Click on callstack should jump to that instruction address (if possible), when disassembly view is in focus.
  • Add and Remove Instruction Breakpoints with the Disassembly View.
    • Added breakpoints should appear in the Breakpoint View List.
    • Remove instruction breakpoint or by breakpoint view list, both should update.
    • Click on address should open to breakpoint.
    • Instruction breakpoints should survive debug sessions (but not VS Code restarts).

Reference Links

@weinand weinand added debug Debug viewlet, configurations, breakpoints, adapter issues testplan-item labels Jul 22, 2021
@weinand weinand added this to the July 2021 milestone Jul 22, 2021
@microsoft microsoft deleted a comment from github-actions bot Jul 22, 2021
@isidorn isidorn self-assigned this Jul 26, 2021
@microsoft microsoft deleted a comment from xisui-MSFT Jul 26, 2021
@microsoft microsoft deleted a comment from yuehuang010 Jul 26, 2021
@microsoft microsoft deleted a comment from yuehuang010 Jul 26, 2021
@weinand
Copy link
Contributor Author

weinand commented Jul 26, 2021

@yuehuang010, @xisui-MSFT please let me know if my editing has resulted in omissions or errors that needs to be fixed.

@isidorn
Copy link
Contributor

isidorn commented Jul 27, 2021

@yuehuang010, @xisui-MSFT I have created some issues and have pinged you all on those issues.
For fixing them feel free to create a PR per issue and ping me on the PR, that way the review process will be easier.
I think none of the issues are super critical, but we should address all of them in order to get this view to production quality.
Thanks a lot!

@isidorn
Copy link
Contributor

isidorn commented Jul 27, 2021

@yannickowow @vadimcn @Trass3r feedback is very welcome if you got a chance to try the disassembly view out. Thanks a lot!

@yannickowow
Copy link
Contributor

yannickowow commented Jul 27, 2021

Hi, first of all, thanks for your work!
Unfortunately, I will not be able to test this feature using my extension since I finished my apprenticeship. These observations are done using C/C++ Extensions.

What I've encountered currently is:

  • Instruction Breakpoints does not support condition / hitCondition updates
  • Current line is not highlighted in green when you switch in a deeper call from the callStack (should be yellow in first and then green for others)
  • We are missing a command to open this view from the Command Palette or directly from the Call Stack (if needed ?) [you figured it out and opened an issue]
  • Disabled Breakpoint does not show as disabled in glyph margin from the Disassembly View
  • Missing the ability to do a step by step (this might be a limitation to current C/C++)
  • Remove all breakpoints does not remove Instruction Breakpoints
  • Instruction Breakpoints are toggled but seems to not work (C/C++ Extension logging remains empty after instruction breakpoint toggled)

Suggestions

  • Ability to reorder columns
  • New command to execute a step instruction ? If not, we might override the current stepping icon to describe as an instruction step
  • For C/C++ Dev., Breakpoints should have a instructionReference, this will allow Source Breakpoints to be linked directly in the Assembly View.

@Trass3r
Copy link

Trass3r commented Jul 27, 2021

It doesn't work at all for me on a simple WSL2 hello world CMake project.

<--   C (disassemble-14): {"command":"disassemble","arguments":{"memoryReference":"0x0000000000202118","offset":0,"instructionOffset":-50,"instructionCount":100,"resolveSymbols":true},"type":"request","seq":14}
--> R (disassemble-14): {"type":"response","request_seq":14,"success":false,"command":"disassemble","message":"Unable to disassemble. The method or operation is not implemented.","body":{},"seq":668}

So somewhere in HandleDisassembleRequestAsync a NotImplementedException gets thrown.

Version: 1.59.0-insider (user setup)
Commit: 955a1aca9a2e4473eec4f4bdc70506a3a7c43ca7
Date: 2021-07-26T05:13:58.801Z
OS: Windows_NT x64 10.0.19043, WSL2

@isidorn
Copy link
Contributor

isidorn commented Jul 27, 2021

@yannickowow thanks a lot for your help, really appreciate it. Out of your findings:

Instruction Breakpoints does not support condition / hitCondition updates

This is a fair feature request, but I would not add it yet. Too advanced IMHO and can be later added

Current line is not highlighted in green when you switch in a deeper call from the callStack (should be yellow in first and then green for others)

Good catch. Created #129574

We are missing a command to open this view from the Command Palette or directly from the Call Stack (if needed ?) [you figured it out and opened an issue]

This is captured via #129540

Disabled Breakpoint does not show as disabled in glyph margin from the Disassembly View

Created #129571

Missing the ability to do a step by step (this might be a limitation to current C/C++)

Can you please create an issue in the C++ repo? This works for mock debug

Remove all breakpoints does not remove Instruction Breakpoints

Created #129572

Instruction Breakpoints are toggled but seems to not work (C/C++ Extension logging remains empty after instruction breakpoint toggled)
I think this should be fixed as part of #129571

@Trass3r that sounds like a C++ issue. Can you please open a new issue in this repo https://github.com/microsoft/vscode-cpptools

@Trass3r
Copy link

Trass3r commented Jul 27, 2021

@Trass3r that sounds like a C++ issue. Can you please open a new issue in this repo https://github.com/microsoft/vscode-cpptools

It works with my main build so let's wait for the next release.
Just the performance is very bad when single stepping.

@yannickowow
Copy link
Contributor

I did some retries using disassembly and source and yeah, it toggles the instruction granularity, all fine 👍.
It looks more like an issue with C/C++.

@Trass3r It looks like the issue is coming from C/C++ Extension.
Here is an example, when I use a Step Into command from Disassembly View:

<--   C (stepIn-39): {"command":"stepIn","arguments":{"threadId":1,"granularity":"instruction"},"type":"request","seq":39}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (56131) <-1159-exec-step\r\n"},"seq":2633}
1: (56131) <-1159-exec-step
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (56146) ->1159^running\r\n"},"seq":2635}
1: (56146) ->1159^running

I think, in this case, that you should use -exec-step-instruction instead.

@Trass3r
Copy link

Trass3r commented Jul 27, 2021

Ah yes my step granularity PR has only recently been merged.

@yuehuang010
Copy link
Contributor

FYI.

  • Condition/Disable BP will be added next milestone.
  • The C++ Debugger for GDB or Linux (MIEngine) will needs some patching to support instruction Stepping and Breakpoint. Using MSVC works.
  • Stepping is based on which panel has focus. If this is confusing, will consider adding some visual queues.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues testplan-item
Projects
None yet
Development

No branches or pull requests

6 participants