Xcode debuggin

111 views
Skip to first unread message

Mark Diener

unread,
Mar 30, 2022, 12:12:02 PM3/30/22
to mi...@dartlang.org
Hello Dart Devs:

I know most of you are developing on Linux computers using VIM.

But I am building on MacOS using Xcode.

Built latest: HEAD detached at 88846ca4b45

./tools/build.py --no-goma --mode debug --arch arm64 create_sdk

Generating binaries successfully.

marco@Marks-MacBook-Pro DebugARM64 % ./dart --version
Dart SDK version: 2.17.0-edge.88846ca4b45f4a57620b888849d27548e5bc3622 (be) (Wed Mar 30 13:01:40 2022 +0000) on "macos_arm64"

I can open ./xcodebuild/DebugARM64/all.xcodeproj.  But Xcode is confused by the structure
of the project and the inclusion of "Ninja" files, so while I can build the binaries again in Xcode, I cannot debug or set a breakpoint in main.cc (path: source/runtime/bin/main.cc)

For example, Xcode error:

Details


Could not launch “dart”

Domain: IDEDebugSessionErrorDomain

Code: 3

Failure Reason: LLDB provided no error string.

User Info: {

    DVTErrorCreationDateKey = "2022-03-30 16:02:31 +0000";

    DVTRadarComponentKey = 855031;

    IDERunOperationFailingWorker = DBGLLDBLauncher;

    RawUnderlyingErrorMessage = "LLDB provided no error string.";

}



Does any Dart Dev have some idea of how to make adjustments so that I can actually step into

the code for the dart main binary and the dart vm.


Best,

Mark Diener

Daco Harkes

unread,
Apr 13, 2022, 11:44:43 AM4/13/22
to Dart Misc, markdi...@gmail.com
Dear Mark,

I have not used Xcode for native debugging.

Instead, I use VSCode with:
- C++ plugin, but disabled intelli sense engine
- the clangd plugin with the executable pointed to the clangd in buildtools
- and LLDB used from VSCode

my workspace file looks like the following:
{
    "launch": {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "ccpdbg dart",
                "type": "cppdbg",
                "request": "launch",
                "program": "${workspaceFolder}/xcodebuild/DebugARM64/dart",
                "args": [
                    "--print-flow-graph",
                    "--print-flow-graph-filter=Ffi",
                    "--disassemble",
                    "${workspaceFolder}/tests/ffi/data_test.dart"
                ],
                "stopAtEntry": false,
                "cwd": "${workspaceFolder}/xcodebuild/DebugARM64/",
                "environment": [],
                "externalConsole": false,
                "MIMode": "lldb",
                "sourceFileMap": {
                    "../../": "${workspaceFolder}/",
                },
            },
        ]
    },
    "folders": [
        {
            "path": "sdk"
        }
    ],
    "settings": {
        "C_Cpp.intelliSenseEngine": "Disabled",
        "clangd.path": "buildtools/mac-x64/clang/bin/clangd"
    },
}


I'm on an M1 arm64, replace DebugARM64 with DebugX64 for an x64 machine.

The build is with tools/build.py as you have already discovered.

I hope this helps.

Kind regards,

Daco Harkes

Daco Harkes

unread,
Apr 13, 2022, 11:52:21 AM4/13/22
to Dart Misc, Daco Harkes, markdi...@gmail.com
Hey Mark,

One more thing for a vscode setup: tools/generate_idefiles.py generates a compile_commands.json for the clangd analysis server.

Kind regards,

Daco
Reply all
Reply to author
Forward
0 new messages