Skip to content

Test Disassembly view #129161

Closed
Closed

Description

Refs: #124163, #125737

Complexity: 4

Create Issue


Thanks to the C++ team (especially Yue (Felix) Huang (@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

Activity

  1. deleted a comment from xisui-MSFT on Jul 26, 2021
  2. weinand commented on Jul 26, 2021

    @weinand
    ContributorAuthor

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

  3. isidorn commented on Jul 27, 2021

    @isidorn

    Yue (Felix) Huang (@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!

  4. isidorn commented on Jul 27, 2021

    @isidorn

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

  5. yannickowow commented on Jul 27, 2021

    @yannickowow
    Contributor

    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.
  6. Trass3r commented on Jul 27, 2021

    @Trass3r

    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
    
  7. isidorn commented on Jul 27, 2021

    @isidorn

    Yanis HAMITI (@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

  8. Trass3r commented on Jul 27, 2021

    @Trass3r

    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.

  9. yannickowow commented on Jul 27, 2021

    @yannickowow
    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.

  10. Trass3r commented on Jul 27, 2021

    @Trass3r

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

  11. yuehuang010 commented on Jul 28, 2021

    @yuehuang010
    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.
  12. locked and limited conversation to collaborators on Sep 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    debugDebug viewlet, configurations, breakpoints, adapter issuestestplan-item

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions