Skip to content

Support Apple Silicon ARM64 architecture natively for debugger #7035

Closed

Description

Type: Debugger

This feature request is to have debugger binaries to run natively on Apple Silicon ARM64.

The feature request to have the language server binaries to run natively on Apple Silicon ARM64 is tracked by
#6595

Note: the cpptools, cpptools-srv, and debugger binaries built for macOS x64 may work on Apple Silicon's x64 emulator, however this may use more resources than having binaries run natively as ARM64 on Apple Silicon.

Activity

  1. XIAZY commented on Mar 18, 2021

    @XIAZY

    Just some extra info here. VSCode (stable channel) has been released for ARM64-based Macs. Attempting to start debuggers on ARM64 Macs with "targetArchitecture": "arm64" will yield this error:

    ERROR: Unable to start debugging. Unexpected LLDB output from command "-exec-run". process exited with status -1 (attach failed ((os/kern) invalid argument))
    
  2. Lihp8270 commented on Apr 13, 2021

    @Lihp8270

    I'm also experiencing the same issue on the latest update on VSCode running natively on M1.

  3. michelleangela commented on Apr 13, 2021

    @michelleangela
    ContributorAuthor

    Lihp8270
    The feature to support native debugging on Apple Silicon ARM64 has not been done yet. You can run the current debugger binaries built for Apple Intel x64 using the Rosetta emulator. Note that the debugger for Apple Intel x64 can only debug x86_64 binaries.

  4. jmarti44 commented on May 6, 2021

    @jmarti44

    Any updates on this. I've been having issues running the debugger the debugger for C++

  5. benjirer commented on May 12, 2021

    @benjirer

    Does anyone know if this has been fixed? Quite new to vs code, would you recommend downloading the intel version and running through rosetta to use the debugger?

  6. cloph commented on May 12, 2021

    @cloph

    Does anyone know if this has been fixed? Quite new to vs code, would you recommend downloading the intel version and running through rosetta to use the debugger?

    No, get the M1 version of Visual Studio Code - but the application you want to debug needs to be built for x86_64 and will be run via Rosetta.

  7. benjirer commented on May 12, 2021

    @benjirer

    Thanks for the hint! Building using Clang x86_64-apple-darwin and then debugging yields the same error. I think I'm way in over my head here, do I need to change anything else?

  8. nicudo commented on May 14, 2021

    @nicudo

    You need both the executable and the debugger to target x86_64.
    I have: "targetArchitecture": "x86_64" in launch.json and "-DCMAKE_OSX_ARCHITECTURES=x86_64" in my build command (use --target=x86-64 if you just use clang).

  9. kinkard commented on May 15, 2021

    @kinkard

    Benjamin Hoffman (@benjirer) As alternative, you may try another debug extension for C++ - https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb which is able to debug native M1 binaries.

    To switch to CodeLLDB debug extension you need to update your launch.json and set "type": "lldb" and all should work fine.

  10. stelatoris commented on May 24, 2021

    @stelatoris

    You need both the executable and the debugger to target x86_64.
    I have: "targetArchitecture": "x86_64" in launch.json and "-DCMAKE_OSX_ARCHITECTURES=x86_64" in my build command (use --target=x86-64 if you just use clang).

    I'm new to all of this so bare with me please. When you say place -DCMAKE_OSX_ARCHITECTURES=x86_64 in your build command? What do you mean by build command? Is it the tasks.json? More info would be greatly appreciated.

    I just migrated from Windows to Mac, but getting an IDE for C++ has proven to be a headache, now I'm contemplating going back to VS Community on Windows.

  11. theFabriZ commented on May 24, 2021

    @theFabriZ

    I just migrated from Windows to Mac, but getting an IDE for C++ has proven to be a headache, now I'm contemplating going back to VS Community on Windows.

    Currently the best C++ IDE on a Mac with M1 is Xcode of Apple, while wait vscode ...

  12. jsm174 commented on May 24, 2021

    @jsm174

    stelatoris, I have a normal library and test executable. When I started using my M1, I could not debug it unless I specified for cmake to only build the x86_x64 version. To do that, go into Settings -> Cmake: Configure Args:

    Screen Shot 2021-05-24 at 5 12 27 PM

    Otherwise, cmake will build one binary with both x86_x64 and arm_x64 slices, and the debugger will try to run the arm_x64 slice.

  13. stelatoris commented on May 24, 2021

    @stelatoris

    I just migrated from Windows to Mac, but getting an IDE for C++ has proven to be a headache, now I'm contemplating going back to VS Community on Windows.

    Currently the best C++ IDE on a Mac with M1 is Xcode of Apple, while wait vscode ...

    I tried Xcode, but it does not seem to highlight anything for C++ syntax like Intelisense or VS Community. Do I need to install some plugins? I'm new to programming, for about 5 months now. So I'm not building anything heavy, just simple multi file programs while I go through Stroustrups PPP book.

    What about CLion? The demo I tried seems to be close enough to VS Community feel.

  14. 14 remaining items

  15. lademinoye commented on Dec 5, 2021

    @lademinoye

    Ditto!

  16. floooh commented on Dec 6, 2021

    @floooh

    +1

  17. ilg-ul commented on Dec 10, 2021

    @ilg-ul

    +1

  18. 1111mp commented on Dec 20, 2021

    @1111mp

    +1

  19. janekb04 commented on Dec 26, 2021

    @janekb04

    I believe I have found a better workaround until this gets fixed. I used -DCMAKE_OSX_ARCHITECTURES=x86_64;arm64. This makes CMake generate a Universal build which contains both an Intel-compatible and an Apple Silicon native executable.

    Apparently, when this build is ran without a debugger (with ⇧ fn F5), the native ARM executable gets chosen. At the same time, when running with a debugger (with ⌃ fn F5) the Intel one runs and it can be successfully debugged.

  20. AvivPeledTalon commented on Dec 28, 2021

    @AvivPeledTalon

    This would help a lot! +1

  21. kammce commented on Feb 10, 2022

    @kammce

    Just hit this issue. +1

  22. FischLu commented on Feb 18, 2022

    @FischLu

    Why after one and half years of M1 MacBook release, this basic feature is still unsupported? Are there any terrible challenges? Why CodeLLDB can do it?

  23. sean-mcmanus commented on Feb 18, 2022

    @sean-mcmanus
    Contributor

    FischLu Build lab issues. We're working on it.

  24. 1111mp commented on Mar 6, 2022

    @1111mp

    Good things are worth the wait.

  25. added
    fixedCheck the Milestone for the release in which the fix is or will be available.
    on Mar 9, 2022
  26. Colengms commented on Mar 10, 2022

    @Colengms
    Contributor

    Native debugging support for M1 macOS has been added in 1.9.3.

  27. blue42 commented on Dec 21, 2022

    @blue42

    Colen Garoutte-Carson (@Colengms) I am actually having this same issue. Running cpptools version 1.13.8 on an Intel mac. Getting the exact same error as the OP stated

    Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
    ERROR: Unable to start debugging. Unexpected LLDB output from command "-exec-run". process exited with status -1 (attach failed (Not allowed to attach to process.  Look in the console messages (Console.app), near the debugserver entries, when the attach failed.  The subsystem that denied the attach permission will likely have logged an informative message about why it was denied.))
    The program '/Path/to/Project/GameDev/dapper-dasher/main' has exited with code 42 (0x0000002a)
    

    launch.json

    {
      // Use IntelliSense to learn about possible attributes.
      // Hover to view descriptions of existing attributes.
      // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
          "version": "0.2.0",
          "configurations": [
            {
              "name": "Debug",
              "type": "cppdbg",
              "request": "launch",
              "program": "${workspaceFolder}/${fileBasenameNoExtension}",
              "args": [],
              "stopAtEntry": false,
              "cwd": "${workspaceFolder}",
              "environment": [],
              "externalConsole": false,
              "MIMode": "gdb",
              "setupCommands": [
                {
                  "description": "Enable pretty-printing for gdb",
                  "text": "-enable-pretty-printing",
                  "ignoreFailures": false
                }
              ],
              "windows": {
                "miDebuggerPath": "C:/raylib/w64devkit/bin/gdb.exe",
              },
              "osx": {
                "MIMode": "lldb"
              },
              "linux": {
                "miDebuggerPath": "/usr/bin/gdb",
              },
              "preLaunchTask": "build debug"
            },
            {
              "name": "Run",
              "type": "cppdbg",
              "request": "launch",
              "args": [],
              "stopAtEntry": false,
              "cwd": "${workspaceFolder}",
              "environment": [],
              "externalConsole": false,
              "program": "${workspaceFolder}/${fileBasenameNoExtension}",
              "MIMode": "gdb",
              "windows": {
                "program": "${workspaceFolder}/${fileBasenameNoExtension}.exe",
                "miDebuggerPath": "C:/raylib/w64devkit/bin/gdb.exe"
              },
              "osx": {
                "MIMode": "lldb"
              },
              "linux": {
                "miDebuggerPath": "/usr/bin/gdb"
              },
              "preLaunchTask": "build release",
            }
          ]
        }
    

    I did not have any issues two days ago, and now I am getting this error. I haven't changed anything.

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

    Feature RequestdebuggerfixedCheck the Milestone for the release in which the fix is or will be available.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions