[Macro] Xcode does not stop on peer macro breakpoints

I am using Version 15.0 beta 6 (15A5219j), it seems the breakpoints work on the expression macro but does not work for peer macro.
Code:

public struct StringifyMacro: ExpressionMacro {
    public static func expansion(
        of node: some FreestandingMacroExpansionSyntax,
        in context: some MacroExpansionContext
    ) -> ExprSyntax {
        guard let argument = node.argumentList.first?.expression else {
            fatalError("compiler bug: the macro does not have any arguments")
        }
        
        // breakpoint 1 here

        return "(\(argument), \(literal: argument.description))"
    }
}

public struct MyPeerMacro: PeerMacro {
    public static func expansion(of node: SwiftSyntax.AttributeSyntax, providingPeersOf declaration: some SwiftSyntax.DeclSyntaxProtocol, in context: some SwiftSyntaxMacros.MacroExpansionContext) throws -> [SwiftSyntax.DeclSyntax] {
        
        guard let firstChild = node.children(viewMode: .all).first else {
            fatalError("!!!")
        }
        
        // breakpoint 2 here
        return []
    }
}

Is it my problem or Xcode's problem? Thx.

When do you expect the breakpoint to get hit? While you run a test with assertMacroExpansion (in which case I don’t see any reason why it shouldn’t be hit) or while you are compiling the code (in which case the macro plugin doesn’t run with a debugger attached, so no breakpoint should be hit)?

Hi, my test code:

    func testMacro() throws {
        #if canImport(MyMacroMacros)
        assertMacroExpansion(
            """
            #stringify(a + b)
            """,
            expandedSource: """
            (a + b, "a + b")
            """,
            macros: testMacros
        )
        #else
        throw XCTSkip("macros are only supported when running tests for the host platform")
        #endif
    }

    func testMacroWithStringLiteral() throws {
        #if canImport(MyMacroMacros)
        assertMacroExpansion(
            #"""
            @MyPeer
            func add(_ a: Int, _ b: Int) -> Int {
                return a+b
            }
            """#,
            expandedSource: #"""
            @MyPeer
            func add(_ a: Int, _ b: Int) -> Int {
                return a + b
            }
            """#,
            macros: testMacros
        )
        #else
        throw XCTSkip("macros are only supported when running tests for the host platform")
        #endif
    }

The second one (for MyPeerMacro) does not hit anything. I assume both test case should hit their breakpoint during test, right?

Yes, absolutely. I suspect you forgot to add MyPeer to testMacros.

You are right. Thanks😆