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

Allowing arm64 macOS to debug dotnet projects #4288

Merged

Conversation

arthurlockman
Copy link
Contributor

Issue #4277

This commit removes the bit of code that was preventing the .net debugger from starting on Apple Silicon.
I've added a warning message that indicates that you might see unexpected issues when running this way.
This should start working once macOS 11.1 is released next week. (See dotnet/runtime#44958 for more details)

Issue dotnet#4277

This commit removes the bit of code that was preventing the .net debugger from starting on Apple Silicon.
I've added a warning message that indicates that you might see unexpected issues when running this way.
This should start working once macOS 11.1 is released next week. (See dotnet/runtime#44958 for more details)
@codecov
Copy link

codecov bot commented Dec 11, 2020

Codecov Report

Merging #4288 (a01fca4) into master (accb074) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4288   +/-   ##
=======================================
  Coverage   85.99%   85.99%           
=======================================
  Files          60       60           
  Lines        1857     1857           
  Branches      215      215           
=======================================
  Hits         1597     1597           
  Misses        200      200           
  Partials       60       60           
Flag Coverage Δ
integration ?
unit 85.99% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update accb074...a01fca4. Read the comment docs.

Copy link
Contributor

@gregg-miskelly gregg-miskelly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are definitely welcome to do this now if you like, but according to this comment this scenario will not work. So it probably makes sense for that to be resolved before this is merged.

@@ -43,6 +43,9 @@ async function checkForInvalidArchitecture(platformInformation: PlatformInformat
else if (platformInformation.architecture !== "x86_64") {
if (platformInformation.isWindows() && platformInformation.architecture === "x86") {
eventStream.post(new DebuggerPrerequisiteWarning(`[WARNING]: x86 Windows is not currently supported by the .NET Core debugger. Debugging will not be available.`));
} else if (platformInformation.isMacOS() && platformInformation.architecture === "arm64") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't enough - the debugger will still not download. You can likely address that by adding the following to package.json:

    {
      "id": "Debugger",
      "description": ".NET Core Debugger (macOS / x64)",
      "url": "https://download.visualstudio.microsoft.com/download/pr/6f481c2a-74a8-41cc-a115-f2d059242062/96e3d82b95ff1375347fedf0f5c7d4e7/coreclr-debug-osx-x64.zip",
      "fallbackUrl": "https://vsdebugger.blob.core.windows.net/coreclr-debug-1-23-8/coreclr-debug-osx-x64.zip",
      "installPath": ".debugger",
      "platforms": [
        "darwin"
      ],
      // Line 275 of package.json -- Add 'arm64'
      "architectures": [
        "x86_64",
        "arm64"
      ],
      "binaries": [
        "./vsdbg-ui",
        "./vsdbg"
      ],
      "installTestPath": "./.debugger/vsdbg-ui",
      "integrity": "6BAA9A20DAA71018B9912A3E2A48C52A273ADC2E70F7101C12F688F397AD16D8"
    },

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, fixed that.

@dnfadmin
Copy link

dnfadmin commented Dec 11, 2020

CLA assistant check
All CLA requirements met.

@arthurlockman
Copy link
Contributor Author

You are definitely welcome to do this now if you like, but according to this comment this scenario will not work. So it probably makes sense for that to be resolved before this is merged.

Yeah, I've been following along with that thread. It looks like it'll let you debug and hit breakpoints, but it'll crash if you try to do a single step. So it seems like it's half-working.

@gregg-miskelly
Copy link
Contributor

gregg-miskelly commented Dec 11, 2020

Yeah, I've been following along with that thread. It looks like it'll let you debug and hit breakpoints, but it'll crash if you try to do a single step. So it seems like it's half-working.

I don't have a device to play with, but I believe Jan is talking about a single step at an architectural level (setting the single step flag on the processor), which it probably used for way more than just stepping. My guess is that it is more like 99.9% broken then half working :)

@gregg-miskelly
Copy link
Contributor

To make sure, with these changes were you able to confirm that with these changes the debugger is successfully download and you can at least use 'Start Without Debugging' on the target app?

@arthurlockman
Copy link
Contributor Author

To make sure, with these changes were you able to confirm that with these changes the debugger is successfully download and you can at least use 'Start Without Debugging' on the target app?

Could you point me to how I could get tests to run with the Apple Silicon build of VS code? It's currently only on the 1.53.0-exploration build. I'm not that familiar with how the test framework works for VS extensions.

@gregg-miskelly
Copy link
Contributor

@arthurlockman I believe you can just test this manually.

  1. Follow these instructions to launch an "experiment instance" of VS Code using your locally built extension.
  2. In the experimental instance, open a folder with a hello world C# project
  3. The debugger should automatically download and your new warning should get printed.
  4. You can then launch the project using "Start without debugging"

@arthurlockman
Copy link
Contributor Author

@gregg-miskelly alright, got it working.

The debugger successfully installs with the warning I put in:
debugger-install

Then the debugger starts and crashes (as expected):
debugger-run

Run without debugging works successfully!
run-without-debug

@gregg-miskelly
Copy link
Contributor

Thanks for doing this! I will merge this once the CI completes.

@arthurlockman
Copy link
Contributor Author

No problem! Glad I could help!

@gregg-miskelly gregg-miskelly merged commit 7d7b69d into dotnet:master Dec 11, 2020
@arthurlockman arthurlockman deleted the feature/dotnetDebugOnAppleSilicon branch December 12, 2020 01:52
@@ -273,7 +273,8 @@
"darwin"
],
"architectures": [
"x86_64"
"x86_64",
"arm64"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arthurlockman @gregg-miskelly do you have some context why -x64.zip is installed for arm64?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to debug x64 processes on an M1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants